Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 24381:d8a682d4c692 legacy-trunk
Don't be so hasty. If PyInt_AsLong() raises an error, don't set ValueError.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Thu, 25 Jul 2002 16:43:29 +0000 |
| parents | aa9e054270a2 |
| children | ea4821964043 |
line wrap: on
line diff
--- a/Objects/typeobject.c Thu Jul 25 16:37:51 2002 +0000 +++ b/Objects/typeobject.c Thu Jul 25 16:43:29 2002 +0000 @@ -2972,6 +2972,8 @@ 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");
