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
```
This commit is contained in:
Kabir Kwatra 2022-05-03 15:14:25 -07:00 committed by GitHub
parent ee2205b208
commit 48c6165c28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 3 deletions

View file

@ -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.
*/