Skip to content

Commit eeb701a

Browse files
authored
bpo-42979: _zoneinfo exec function checks for PyDateTime_IMPORT failure (GH-24333)
Importing datetime can fail.
1 parent 6790005 commit eeb701a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/_zoneinfo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,6 +2629,9 @@ static int
26292629
zoneinfomodule_exec(PyObject *m)
26302630
{
26312631
PyDateTime_IMPORT;
2632+
if (PyDateTimeAPI == NULL) {
2633+
goto error;
2634+
}
26322635
PyZoneInfo_ZoneInfoType.tp_base = PyDateTimeAPI->TZInfoType;
26332636
if (PyType_Ready(&PyZoneInfo_ZoneInfoType) < 0) {
26342637
goto error;

0 commit comments

Comments
 (0)