Mercurial > cpython-lru_cache-weakref
comparison Python/bltinmodule.c @ 42899:a49665f8d2f4
Added test to ensure __format__ methods return unicode objects.
| author | Eric Smith <eric@trueblade.com> |
|---|---|
| date | Mon, 27 Aug 2007 15:31:40 +0000 |
| parents | 0020bc784c76 |
| children | cdb7b9f82cc4 |
comparison
equal
deleted
inserted
replaced
| 42898:0020bc784c76 | 42899:a49665f8d2f4 |
|---|---|
| 310 } | 310 } |
| 311 | 311 |
| 312 /* And call it, binding it to the value */ | 312 /* And call it, binding it to the value */ |
| 313 result = PyObject_CallFunctionObjArgs(meth, value, spec, NULL); | 313 result = PyObject_CallFunctionObjArgs(meth, value, spec, NULL); |
| 314 | 314 |
| 315 #if 0 | 315 if (result && !PyUnicode_Check(result)) { |
| 316 /* XXX this is segfaulting, not sure why. find out later! */ | |
| 317 if (!PyUnicode_Check(result)) { | |
| 318 PyErr_SetString(PyExc_TypeError, | 316 PyErr_SetString(PyExc_TypeError, |
| 319 "__format__ method did not return string"); | 317 "__format__ method did not return string"); |
| 320 Py_DECREF(result); | 318 Py_DECREF(result); |
| 321 return NULL; | 319 return NULL; |
| 322 } | 320 } |
| 323 #endif | |
| 324 | 321 |
| 325 return result; | 322 return result; |
| 326 } | 323 } |
| 327 | 324 |
| 328 | 325 |
