summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/typeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 96fc7cd..3def134 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2972,6 +2972,8 @@ slot_sq_length(PyObject *self)
return -1;
len = (int)PyInt_AsLong(res);
Py_DECREF(res);
+ if (len == -1 && PyErr_Occurred())
+ return -1;
if (len < 0) {
PyErr_SetString(PyExc_ValueError,
"__len__() should return >= 0");