[Python-3000-checkins] r55895 - python/branches/py3k-struni/Objects/typeobject.c

walter.doerwald python-3000-checkins at python.org
Mon Jun 11 17:47:21 CEST 2007


Author: walter.doerwald
Date: Mon Jun 11 17:47:13 2007
New Revision: 55895

Modified:
   python/branches/py3k-struni/Objects/typeobject.c
Log:
Simplify error formatting and type_repr().


Modified: python/branches/py3k-struni/Objects/typeobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/typeobject.c	(original)
+++ python/branches/py3k-struni/Objects/typeobject.c	Mon Jun 11 17:47:13 2007
@@ -384,12 +384,8 @@
 	else
 		kind = "type";
 
-	if (mod != NULL && strcmp(PyUnicode_AsString(mod), "__builtin__")) {
-		rtn = PyUnicode_FromFormat("<%s '%s.%s'>",
-					  kind,
-					  PyUnicode_AsString(mod),
-					  PyUnicode_AsString(name));
-	}
+	if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "__builtin__"))
+		rtn = PyUnicode_FromFormat("<%s '%U.%U'>", kind, mod, name);
 	else
 		rtn = PyUnicode_FromFormat("<%s '%s'>", kind, type->tp_name);
 
@@ -2155,8 +2151,8 @@
 
 	/* Give up */
 	PyErr_Format(PyExc_AttributeError,
-			 "type object '%.50s' has no attribute '%.400s'",
-			 type->tp_name, PyUnicode_AsString(name));
+	             "type object '%.50s' has no attribute '%U'",
+	             type->tp_name, name);
 	return NULL;
 }
 


More information about the Python-3000-checkins mailing list