Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 54325:0c617b7a727a legacy-trunk
handle errors from _PyObject_LookupSpecial when __get__ fails
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Mon, 25 May 2009 02:40:21 +0000 |
| parents | 150986ab3db2 |
| children | 164d64b39ac0 |
line wrap: on
line diff
--- a/Python/sysmodule.c Mon May 25 00:48:58 2009 +0000 +++ b/Python/sysmodule.c Mon May 25 02:40:21 2009 +0000 @@ -669,10 +669,12 @@ else { PyObject *method = _PyObject_LookupSpecial(o, "__sizeof__", &str__sizeof__); - if (method == NULL) - PyErr_Format(PyExc_TypeError, - "Type %.100s doesn't define __sizeof__", - Py_TYPE(o)->tp_name); + if (method == NULL) { + if (!PyErr_Occurred()) + PyErr_Format(PyExc_TypeError, + "Type %.100s doesn't define __sizeof__", + Py_TYPE(o)->tp_name); + } else { res = PyObject_CallFunctionObjArgs(method, NULL); Py_DECREF(method);
