summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2007-08-27 15:31:40 (GMT)
committerEric Smith <eric@trueblade.com>2007-08-27 15:31:40 (GMT)
commit56e4a840bcb9ae7536747ba96fd83cc2a1bfa69b (patch)
tree8e0cca6a5fdd1cf3d4a865f5a4509f33fe7f4c16 /Python/bltinmodule.c
parenta4b8d1de7c8bdacfa07f9545fcef81fee1c6601f (diff)
downloadcpython-56e4a840bcb9ae7536747ba96fd83cc2a1bfa69b.zip
cpython-56e4a840bcb9ae7536747ba96fd83cc2a1bfa69b.tar.gz
cpython-56e4a840bcb9ae7536747ba96fd83cc2a1bfa69b.tar.bz2
Added test to ensure __format__ methods return unicode objects.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c5
1 files changed, 1 insertions, 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;
}