GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-103857: Document utcnow and utcfromtimestamp deprecations in What's New by hugovk · Pull Request #104542 · python/cpython

Conversation

@hugovk

@hugovk hugovk commented May 16, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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).

  • Issue: Deprecate utcnow and utcfromtimestamp #103857

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hugovk added 2 commits May 16, 2023 14:00
@hugovk
Document utcnow and utcfromtimestamp deprecations in What's New
1cf7916
@hugovk
Fix typo: use fromtimestamp(datetime.UTC) instead of utcfromtimestamp()
e0ff7f5
@hugovk
hugovk requested review from abalkin and pganssle as code owners May 16, 2023 11:35
@bedevere-bot bedevere-bot added the awaiting core review label May 16, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 16, 2023
Deprecate utcnow and utcfromtimestamp #103857
Closed
@hugovk hugovk added the skip news label May 16, 2023
@hugovk
Add timestamp arg to datetime.now call
efc1e99
pganssle
pganssle reviewed May 17, 2023
View reviewed changes
Comment thread Modules/_datetimemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_datetimemodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hugovk @pganssle
Fix params in docs
24ef1f3
Co-authored-by: Paul Ganssle <[email protected]>
@hugovk hugovk added the docs Documentation in the Doc dir label May 19, 2023
@hugovk

hugovk commented May 21, 2023

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
@bedevere-bot bedevere-bot removed the awaiting core review label May 21, 2023
@wjandrea wjandrea mentioned this pull request Jul 4, 2023
datetime UTC deprecation warnings use the name "datetime" inconsistently #106392
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Aug 1, 2026
Bounty Claim: Fix for issue #1727 moorcheh-ai/memanto#1754
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pganssle pganssle pganssle left review comments
@abalkin abalkin Awaiting requested review from abalkin

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@hugovk @pganssle @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.