aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 89fe82c7c39..9eb725f062b 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5931,6 +5931,7 @@ slot_sq_length(PyObject *self)
assert(PyLong_Check(res));
if (Py_SIZE(res) < 0) {
+ Py_DECREF(res);
PyErr_SetString(PyExc_ValueError,
"__len__() should return >= 0");
return -1;