summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/datetimemodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 6823110..a8fa4e7 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3825,6 +3825,10 @@ datetime_strptime(PyObject *cls, PyObject *args)
if (PySequence_Check(obj) && PySequence_Size(obj) >= 6)
for (i=0; i < 6; i++) {
PyObject *p = PySequence_GetItem(obj, i);
+ if (p == NULL) {
+ Py_DECREF(obj);
+ return NULL;
+ }
if (PyInt_Check(p))
ia[i] = PyInt_AsLong(p);
else