mirror of https://github.com/python/cpython
bpo-42979: _zoneinfo exec function checks for PyDateTime_IMPORT failure (GH-24333)
Importing datetime can fail.
This commit is contained in:
parent
6790005a9a
commit
eeb701adc0
|
@ -2629,6 +2629,9 @@ static int
|
||||||
zoneinfomodule_exec(PyObject *m)
|
zoneinfomodule_exec(PyObject *m)
|
||||||
{
|
{
|
||||||
PyDateTime_IMPORT;
|
PyDateTime_IMPORT;
|
||||||
|
if (PyDateTimeAPI == NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
PyZoneInfo_ZoneInfoType.tp_base = PyDateTimeAPI->TZInfoType;
|
PyZoneInfo_ZoneInfoType.tp_base = PyDateTimeAPI->TZInfoType;
|
||||||
if (PyType_Ready(&PyZoneInfo_ZoneInfoType) < 0) {
|
if (PyType_Ready(&PyZoneInfo_ZoneInfoType) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Reference in New Issue