Added test to ensure __format__ methods return unicode objects.

This commit is contained in:
Eric Smith 2007-08-27 15:31:40 +00:00
parent a4b8d1de7c
commit 56e4a840bc

View file

@ -312,15 +312,12 @@ builtin_format(PyObject *self, PyObject *args)
/* And call it, binding it to the value */ /* And call it, binding it to the value */
result = PyObject_CallFunctionObjArgs(meth, value, spec, NULL); result = PyObject_CallFunctionObjArgs(meth, value, spec, NULL);
#if 0 if (result && !PyUnicode_Check(result)) {
/* XXX this is segfaulting, not sure why. find out later! */
if (!PyUnicode_Check(result)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"__format__ method did not return string"); "__format__ method did not return string");
Py_DECREF(result); Py_DECREF(result);
return NULL; return NULL;
} }
#endif
return result; return result;
} }