Commit 73a088e3 authored by Jeremy Hylton's avatar Jeremy Hylton

Don't be so hasty. If PyInt_AsLong() raises an error, don't set ValueError.

parent 825e47b6
......@@ -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");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment