mirror of https://github.com/python/cpython
fix a refleak in slot_sq_length (#1162)
This commit is contained in:
parent
55fe1ae970
commit
8e1ddbd592
|
@ -5931,6 +5931,7 @@ slot_sq_length(PyObject *self)
|
||||||
|
|
||||||
assert(PyLong_Check(res));
|
assert(PyLong_Check(res));
|
||||||
if (Py_SIZE(res) < 0) {
|
if (Py_SIZE(res) < 0) {
|
||||||
|
Py_DECREF(res);
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"__len__() should return >= 0");
|
"__len__() should return >= 0");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue