diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-25 03:10:48 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-25 03:10:48 +0000 |
commit | f447be974b50e6380b49f709bc6d6b48451e08e6 (patch) | |
tree | 8cdeb1a7dc2e86b86c8a1ce72d388fd4be77ff76 /Python/sysmodule.c | |
parent | cd1d330de2855c914e7716d6e58d179584ebd59d (diff) | |
download | cpython-f447be974b50e6380b49f709bc6d6b48451e08e6.tar.gz |
Merged revisions 72907 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72907 | benjamin.peterson | 2009-05-24 21:40:21 -0500 (Sun, 24 May 2009) | 1 line
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 6639acc7d1..89613ecbc2 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -652,10 +652,12 @@ sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds) 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); |