diff Python/bltinmodule.c @ 42899:a49665f8d2f4

Added test to ensure __format__ methods return unicode objects.
author Eric Smith <eric@trueblade.com>
date Mon, 27 Aug 2007 15:31:40 +0000
parents 0020bc784c76
children cdb7b9f82cc4
line wrap: on
line diff
--- a/Python/bltinmodule.c	Mon Aug 27 15:02:28 2007 +0000
+++ b/Python/bltinmodule.c	Mon Aug 27 15:31:40 2007 +0000
@@ -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;
 }