diff options
author | Eric Smith <eric@trueblade.com> | 2008-01-11 00:17:22 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2008-01-11 00:17:22 (GMT) |
commit | fc6e8fe5edbeb502d6eb699c7c7aa3f00396667f (patch) | |
tree | 3ca38a6cbb73413fa25e3a17059e3367d38f6851 /Objects | |
parent | 0041223f51ffc267417dbd697716add494735b3a (diff) | |
download | cpython-fc6e8fe5edbeb502d6eb699c7c7aa3f00396667f.zip cpython-fc6e8fe5edbeb502d6eb699c7c7aa3f00396667f.tar.gz cpython-fc6e8fe5edbeb502d6eb699c7c7aa3f00396667f.tar.bz2 |
Simplifed argument parsing in object.__format__, added test case.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 2a0dd24..682c029 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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) { |