diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index 50e042afa85..bb94e423116 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -55,6 +55,9 @@ PySlice_New(PyObject *start, PyObject *stop, PyObject *step) { PySliceObject *obj = PyObject_NEW(PySliceObject, &PySlice_Type); + if (obj == NULL) + return NULL; + if (step == NULL) step = Py_None; Py_INCREF(step); if (start == NULL) start = Py_None;