mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
bpo-42979: _zoneinfo exec function checks for PyDateTime_IMPORT failure (GH-24333) (GH-24351)
Importing datetime can fail.
(cherry picked from commit eeb701adc0)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
Co-authored-by: Hai Shi <shihai1992@gmail.com>
This commit is contained in:
parent
cb77c5e1dd
commit
895591c1f0
1 changed files with 3 additions and 0 deletions
|
|
@ -2634,6 +2634,9 @@ static int
|
|||
zoneinfomodule_exec(PyObject *m)
|
||||
{
|
||||
PyDateTime_IMPORT;
|
||||
if (PyDateTimeAPI == NULL) {
|
||||
goto error;
|
||||
}
|
||||
PyZoneInfo_ZoneInfoType.tp_base = PyDateTimeAPI->TZInfoType;
|
||||
if (PyType_Ready(&PyZoneInfo_ZoneInfoType) < 0) {
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue