Simplifed argument parsing in object.__format__, added test case.

This commit is contained in:
Eric Smith 2008-01-11 00:17:22 +00:00
parent 0041223f51
commit fc6e8fe5ed
2 changed files with 5 additions and 5 deletions

View file

@ -2950,12 +2950,8 @@ object_format(PyObject *self, PyObject *args)
PyObject *result = NULL;
PyObject *format_meth = NULL;
if (!PyArg_ParseTuple(args, "O:__format__", &format_spec))
if (!PyArg_ParseTuple(args, "U:__format__", &format_spec))
return NULL;
if (!PyUnicode_Check(format_spec)) {
PyErr_SetString(PyExc_TypeError, "Unicode object required");
return NULL;
}
self_as_str = PyObject_Str(self);
if (self_as_str != NULL) {