summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 6639acc..89613ec 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);