Added test to ensure __format__ methods return unicode objects.
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 284910d..b0b85ba 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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;
}