Skip to content
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

gh-103857: Document utcnow and utcfromtimestamp deprecations in What's New #104542

Merged

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented May 16, 2023

Re: #103857 (comment), add the deprecations to "What's New in 3.12".

Also fix a typo in a deprecation warning.


And should we clarify these warnings?

    if (PyErr_WarnEx(PyExc_DeprecationWarning,
        "datetime.utcnow() is deprecated and scheduled for removal in a "
        "future version. Use timezone-aware objects to represent datetimes "
        "in UTC: datetime.now(datetime.UTC).", 1))
    if (PyErr_WarnEx(PyExc_DeprecationWarning,
        "datetime.utcfromtimestamp() is deprecated and scheduled for removal "
        "in a future version. Use timezone-aware objects to represent "
        "datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC).", 1))

It's really datetime.datetime.utcnow() and datetime.datetime.utcfromtimestamp(), and not datetime.utcnow() and datetime.utcfromtimestamp().

Reason: to avoid confusion with datetime.UTC (which is not really datetime.datetime.UTC).


📚 Documentation preview 📚: https://cpython-previews--104542.org.readthedocs.build/en/104542/whatsnew/3.12.html#deprecated

Modules/_datetimemodule.c Outdated Show resolved Hide resolved
Modules/_datetimemodule.c Outdated Show resolved Hide resolved
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
@hugovk hugovk added the docs Documentation in the Doc dir label May 19, 2023
@hugovk
Copy link
Member Author

hugovk commented May 21, 2023

I think everything is ready here, let's merge so it's in Monday's beta, and we can follow up if necessary.

@hugovk hugovk merged commit 5841fbc into python:main May 21, 2023
@hugovk hugovk deleted the docs-whatsnew-utcnow-utcfromtimestamp-deprecations branch May 21, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants