diff Python/sysmodule.c @ 54326:db212869d814

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 ........
author Benjamin Peterson <benjamin@python.org>
date Mon, 25 May 2009 03:10:48 +0000
parents 89631f627810
children 4d38e51e7cdc
line wrap: on
line diff
--- a/Python/sysmodule.c	Mon May 25 00:51:58 2009 +0000
+++ b/Python/sysmodule.c	Mon May 25 03:10:48 2009 +0000
@@ -652,10 +652,12 @@
 
 	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);