Skip to content

Commit 9c98fda

Browse files
authored
gh-124606: Fix reference leak in error path in datetime_fromisoformat in _datetimemodule.c (#124607)
Previously `tzdata` and `dtstr_clean` were not decrefed in the `invalid_iso_midnight` error path of the `datetime_isoformat` function.
1 parent 257a20a commit 9c98fda

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_datetimemodule.c

+2
Original file line numberDiff line numberDiff line change
@@ -5959,6 +5959,8 @@ datetime_fromisoformat(PyObject *cls, PyObject *dtstr)
59595959

59605960
invalid_iso_midnight:
59615961
PyErr_SetString(PyExc_ValueError, "minute, second, and microsecond must be 0 when hour is 24");
5962+
Py_DECREF(tzinfo);
5963+
Py_DECREF(dtstr_clean);
59625964
return NULL;
59635965

59645966
invalid_string_error:

0 commit comments

Comments
 (0)