summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorKabir Kwatra <kabir@kwatra.me>2022-05-03 22:14:25 (GMT)
committerGitHub <noreply@github.com>2022-05-03 22:14:25 (GMT)
commit48c6165c28dfb40eafd2fa6de9bebd14fbc7c95c (patch)
tree877ad0238cb76142bbbc27318b7ed71fd72c56cc /Modules
parentee2205b208389611e8a278ac1bc74b34f4994fd2 (diff)
downloadcpython-48c6165c28dfb40eafd2fa6de9bebd14fbc7c95c.zip
cpython-48c6165c28dfb40eafd2fa6de9bebd14fbc7c95c.tar.gz
cpython-48c6165c28dfb40eafd2fa6de9bebd14fbc7c95c.tar.bz2
gh-91928: Add `datetime.UTC` alias for `datetime.timezone.utc` (GH-91973)
### fixes #91928 `UTC` is now module attribute aliased to `datetime.timezone.utc`. You can now do the following: ```python from datetime import UTC ```
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_datetimemodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 24c2198..20cdb18 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -6634,6 +6634,10 @@ _datetime_exec(PyObject *module)
return -1;
}
+ if (PyModule_AddObjectRef(module, "UTC", PyDateTime_TimeZone_UTC) < 0) {
+ return -1;
+ }
+
/* A 4-year cycle has an extra leap day over what we'd get from
* pasting together 4 single years.
*/