From 56e4a840bcb9ae7536747ba96fd83cc2a1bfa69b Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Mon, 27 Aug 2007 15:31:40 +0000 Subject: Added test to ensure __format__ methods return unicode objects. --- Python/bltinmodule.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 @@ 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; } -- cgit v0.12