-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
datetime UTC deprecation warnings use the name "datetime" inconsistently #106392
Comments
The specific inconsistency is that |
@wjandrea Thanks for the report, would you like to create a PR to update the deprecation warning text? |
… "datetime" inconsistently python#106392 (python#106392) Replace Modules/_datetimemodule.c's PyExc_DeprecationWarning with 'in UTC: datetime.now(timezone.utc)'.
…106436) They used "datetime" to refer to both the object and the module. (cherry picked from commit d5c5d4b) Co-authored-by: William Andrea <[email protected]>
They used "datetime" to refer to both the object and the module.
… (#108792) gh-106392: Fix inconsistency in deprecation warnings (GH-106436) They used "datetime" to refer to both the object and the module. (cherry picked from commit d5c5d4b) Co-authored-by: William Andrea <[email protected]>
Ah sorry, I was mainly looking at the consistency between |
Previously python#106436 fixed consistency within the suggested replacement, but not in the entire message
…e module (pythonGH-114761) (cherry picked from commit dc4cd2c) Co-authored-by: Serhiy Storchaka <[email protected]>
Solved utcfromtimestamp deprecation by using timezone-aware objects to represent datetimes. (datetime.datetime.fromtimestamp(timestamp, datetime.UTC) Reference: python/cpython#106392
Bug report
The UTC deprecation warnings (added in #103858) use the name
datetime
to refer to both the object and the module, which is confusing. Like, if I copy-paste the code from the warnings, it doesn't work:To fix it, I'd just put
datetime.datetime
where necessary. LMK if you want me to submit a PR.By the way
#104542 brought up the same thing about the deprecated names, but I think it's fine personally:
#105544 might also be relevant, I'm not sure.
Your environment
Linked PRs
The text was updated successfully, but these errors were encountered: