Skip to content

Commit ffe7e74

Browse files
committed
ensure calling Py_XDECREF
1 parent 9e7148b commit ffe7e74

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎Modules/_datetimemodule.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,7 @@ delta_new_impl(PyTypeObject *type, PyObject *days, PyObject *seconds,
28102810
PyObject *current_mod;
28112811
datetime_state *st = GET_CURRENT_STATE(current_mod);
28122812
if (st == NULL) {
2813-
return NULL;
2813+
goto Done;
28142814
}
28152815

28162816
PyObject *x = NULL; /* running sum of microseconds */
@@ -2903,7 +2903,9 @@ delta_new_impl(PyTypeObject *type, PyObject *days, PyObject *seconds,
29032903
Py_XDECREF(minutes);
29042904
Py_XDECREF(hours);
29052905
Py_XDECREF(weeks);
2906-
RELEASE_CURRENT_STATE(st, current_mod);
2906+
if (st != NULL) {
2907+
RELEASE_CURRENT_STATE(st, current_mod);
2908+
}
29072909
return self;
29082910

29092911
#undef CLEANUP

0 commit comments

Comments
 (0)