[Python-3000-checkins] r57559 - python/branches/py3k/Python/bltinmodule.c

eric.smith python-3000-checkins at python.org
Mon Aug 27 17:31:41 CEST 2007


Author: eric.smith
Date: Mon Aug 27 17:31:40 2007
New Revision: 57559

Modified:
   python/branches/py3k/Python/bltinmodule.c
Log:
Added test to ensure __format__ methods return unicode objects.

Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c	(original)
+++ python/branches/py3k/Python/bltinmodule.c	Mon Aug 27 17:31:40 2007
@@ -312,15 +312,12 @@
         /* And call it, binding it to the value */
         result = PyObject_CallFunctionObjArgs(meth, value, spec, NULL);
 
-#if 0
-        /* XXX this is segfaulting, not sure why.  find out later! */
-	if (!PyUnicode_Check(result)) {
+	if (result && !PyUnicode_Check(result)) {
                 PyErr_SetString(PyExc_TypeError,
                                 "__format__ method did not return string");
                 Py_DECREF(result);
                 return NULL;
         }
-#endif
 
         return result;
 }


More information about the Python-3000-checkins mailing list