diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-25 02:40:21 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-25 02:40:21 (GMT) |
commit | 87e5006d8c5974597df9e3074b95227187d32be3 (patch) | |
tree | 82f8ff2dae761cdf19eeec36806f3bbb35b439e1 /Python/sysmodule.c | |
parent | 176a56c69b1563c4a8ac0d8f974b4271177c80ee (diff) | |
download | cpython-87e5006d8c5974597df9e3074b95227187d32be3.zip cpython-87e5006d8c5974597df9e3074b95227187d32be3.tar.gz cpython-87e5006d8c5974597df9e3074b95227187d32be3.tar.bz2 |
handle errors from _PyObject_LookupSpecial when __get__ fails
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 1146746..6eb6b62 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -669,10 +669,12 @@ sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds) 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); |