gh-119655: Fix reference leak in the ``_datetimemodule.c`` (gh-119713)

This commit is contained in:
Kirill Podoprigora 2024-05-29 18:43:03 +03:00 committed by GitHub
parent 1f481fd327
commit 34f9b3e724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -6972,10 +6972,13 @@ _datetime_exec(PyObject *module)
} while (0)
PyTypeObject *PyDateTime_IsoCalendarDateType = NULL;
CREATE_TYPE(PyDateTime_IsoCalendarDateType, &isocal_spec, &PyTuple_Type);
datetime_state *st = get_datetime_state();
if (!st->initialized) {
CREATE_TYPE(PyDateTime_IsoCalendarDateType, &isocal_spec, &PyTuple_Type);
}
#undef CREATE_TYPE
datetime_state *st = get_datetime_state();
if (init_state(st, PyDateTime_IsoCalendarDateType) < 0) {
goto error;
}