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-91928: Add `datetime.UTC` alias for `datetime.timezone.utc` by Kab1r · Pull Request #91973 · python/cpython

Conversation

@Kab1r

@Kab1r Kab1r commented Apr 27, 2022 •
edited by miss-islington
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

fixes #91928

UTC is now module attribute aliased to datetime.timezone.utc.
You can now do the following:

from datetime import UTC

Automerge-Triggered-By: GH:pganssle

Sorry, something went wrong.

Uh oh!

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

All reactions
@Kab1r
Kab1r requested review from abalkin and pganssle as code owners April 27, 2022 00:59
@ghost

ghost commented Apr 27, 2022 •
edited by ghost
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented Apr 27, 2022

Copy link
Copy Markdown

Every change to Python requires a NEWS entry.

Please, add it using the blurb_it Web app or the blurb command-line tool.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added the awaiting review label Apr 27, 2022
pganssle
pganssle requested changes Apr 27, 2022
View reviewed changes

@pganssle pganssle left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks!

In addition to my other comments, two other things:

  1. As I believe you are a first-time contributor, you should probably add your name to Misc/ACKS.
  2. Maybe add a very simple test to TestModule, like this:
def test_utc_alias(self):
    self.assertIs(UTC, timezone.utc)

Thanks for your contribution!

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Misc/NEWS.d/next/Library/2022-04-26-18-02-44.gh-issue-91928.V0YveU.rst Resolved

Uh oh!

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

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

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

Comment thread Doc/library/datetime.rst Resolved

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting changes and removed awaiting review labels Apr 27, 2022
@bedevere-bot

bedevere-bot commented Apr 27, 2022

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@pganssle pganssle mentioned this pull request Apr 27, 2022
Add datetime.UTC alias for datetime.timezone.utc #91928
Closed
@Kab1r

Kab1r commented Apr 27, 2022

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels Apr 27, 2022
@bedevere-bot

bedevere-bot commented Apr 27, 2022

Copy link
Copy Markdown

Thanks for making the requested changes!

@pganssle: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot
bedevere-bot requested a review from pganssle April 27, 2022 20:41
pganssle
pganssle requested changes Apr 27, 2022
View reviewed changes

@pganssle pganssle left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this test?

Maybe add a very simple test to TestModule, like this:

    def test_utc_alias(self):
       self.assertIs(UTC, timezone.utc)

Sorry, something went wrong.

Uh oh!

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

Kab1r reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Doc/library/datetime.rst Resolved

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting changes and removed awaiting change review labels Apr 27, 2022
@bedevere-bot

bedevere-bot commented Apr 27, 2022

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Kab1r

Kab1r commented Apr 27, 2022

Copy link
Copy Markdown
Contributor Author

I had to move the definition of datetime.UTC to the end so that modifications to datetime.timezone.utc doesn't make it a different object.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Kab1r

Kab1r commented Apr 27, 2022

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot added awaiting change review and removed awaiting changes labels Apr 27, 2022
@bedevere-bot

bedevere-bot commented Apr 27, 2022

Copy link
Copy Markdown

Thanks for making the requested changes!

@pganssle: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot
bedevere-bot requested a review from pganssle April 27, 2022 22:20
Kab1r added 4 commits May 3, 2022 14:02
@Kab1r @pganssle
feat(datetime): Add datetime.UTC alias for datetime.timezone.utc
65fbe0d
fixes python#91928
@Kab1r @pganssle
docs: Add NEWS entry for python#91973
ce04985
@Kab1r @pganssle
docs: add contribution acknowledgement
28f228b
@Kab1r @pganssle
docs(datetime): clarify UTC timezone singleton
cefda33
Kab1r and others added 4 commits May 3, 2022 14:02
@Kab1r @pganssle
docs(datetime): add versionadded to datetime.UTC
1e8257d
@Kab1r @pganssle
test(datetime): add test for datetime.UTC alias
7335f0a
@Kab1r @pganssle
fix(datetime): move datetime.UTC definition to end to ensure that i…
185c7ac
…t is an alias
@pganssle
Clean up nits
9542f54
1. Add UTC definition into C implementation as well (just for
   consistency, there's no particular reason not to simply assign the
   alias in the Python code later).

2. Move `..versionadded` tag into the right place
@pganssle
pganssle force-pushed the feat-datetime-utc-alias branch from c097669 to 9542f54 Compare May 3, 2022 20:02
pganssle
pganssle approved these changes May 3, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting change review labels May 3, 2022
pganssle
pganssle approved these changes May 3, 2022
View reviewed changes
@pganssle pganssle added the 🤖 automerge label May 3, 2022
@miss-islington
miss-islington merged commit 48c6165 into python:main May 3, 2022
@bedevere-bot bedevere-bot removed the awaiting merge label May 3, 2022
@pganssle

pganssle commented May 3, 2022

Copy link
Copy Markdown
Member

Thanks @Kab1r!

All reactions

Sorry, something went wrong.

Uh oh!

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

@dignissimus dignissimus mentioned this pull request May 4, 2022
Add datetime.UTC alias python/typeshed#7779
Merged
@jopemachine jopemachine mentioned this pull request Sep 9, 2022
Add datetime.UTC alias for datetime.timezone.utc RustPython/RustPython#4154
Merged
natoscott added a commit to natoscott/pcp that referenced this pull request May 8, 2025
@natoscott
pmseries_import: use a datetime UTC interface from python3.6
e056732
Resolves an issue Ken reported running tests in the QA farm,
which is due to use of an interface from more-recent-python:
python/cpython#91973
@natoscott natoscott mentioned this pull request May 8, 2025
pmseries_import: use a datetime UTC interface from python3.6 performancecopilot/pcp#2203
Merged
@Shixiaowei02 Shixiaowei02 mentioned this pull request May 16, 2025
chore: reduce size of the docker images NVIDIA/TensorRT-LLM#3990
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Mar 24, 2026
Add robust OAI-PMH resume parsing and canonical docs seonghobae/oai-pmh-scraper#1
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Apr 17, 2026
Artifact/reporting contract cleanup and Phase 6 canonicalization Mad-Labs42/quantmap#11
Merged
This was referenced Jun 4, 2026
Enhance band deletion process and auto-flag off-genre bands MaxRickettsUy/le-epic-monorepo#17
Merged
Refactor MEDRE operator surface storage configuration jeremiah-k/medre#87
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Jun 18, 2026
fix: propagate dynamic api network errors and update site_reference dynamically HiDiHo01/home-assistant-frank_energie#162
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Jul 25, 2026
feat(intelligence): natural-language goal creation with structured in… Suncrest-Labs/nester#880
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pganssle pganssle pganssle approved these changes
@abalkin abalkin Awaiting requested review from abalkin

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add datetime.UTC alias for datetime.timezone.utc

Uh oh!

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

4 participants

@Kab1r @bedevere-bot @pganssle @miss-islington
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.