From: Eric Smith Date: Mon, 27 Aug 2007 15:31:40 +0000 (+0000) Subject: Added test to ensure __format__ methods return unicode objects. X-Git-Tag: v3.0a1~209 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56e4a840bcb9ae7536747ba96fd83cc2a1bfa69b;p=thirdparty%2FPython%2Fcpython.git Added test to ensure __format__ methods return unicode objects. --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 284910d9eae7..b0b85ba0d946 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -312,15 +312,12 @@ builtin_format(PyObject *self, PyObject *args) /* 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; }