Skip to content

Commit dc92ee8

Browse files
committed
fix segfault
1 parent fe8403c commit dc92ee8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Modules/_datetimemodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3217,7 +3217,9 @@ delta_new(PyTypeObject *type, PyObject *args, PyObject *kw)
32173217
leftover_ns += 1000;
32183218
}
32193219
self = microseconds_to_delta_ex(x, type);
3220-
SET_TD_NANOSECONDS((PyDateTime_Delta *)self, (long)(leftover_ns)); // todo: py_round
3220+
if (self != NULL){
3221+
SET_TD_NANOSECONDS((PyDateTime_Delta *)self, (long)(leftover_ns)); // todo: py_round
3222+
}
32213223
Py_DECREF(x);
32223224

32233225
Done:

0 commit comments

Comments
 (0)