Skip to content

Commit

Permalink
gh-119655: Fix reference leak in the _datetimemodule.c (gh-119713)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eclips4 authored May 29, 2024
1 parent 1f481fd commit 34f9b3e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 34f9b3e

Please sign in to comment.