diff options
author | Eric Smith <eric@trueblade.com> | 2007-09-01 10:56:01 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2007-09-01 10:56:01 (GMT) |
commit | 37f10386f1bedb992f3d9770b2f71b5edda2abbe (patch) | |
tree | 7c258bc40124636d938c6f7d61840c29fb7952cd /Objects/stringlib/formatter.h | |
parent | a95207ab3bce39b8278fc479d1d391365ffc7a7c (diff) | |
download | cpython-37f10386f1bedb992f3d9770b2f71b5edda2abbe.zip cpython-37f10386f1bedb992f3d9770b2f71b5edda2abbe.tar.gz cpython-37f10386f1bedb992f3d9770b2f71b5edda2abbe.tar.bz2 |
Changed to use 'U' argument to PyArg_ParseTuple, instead of manually checking for unicode objects.
Diffstat (limited to 'Objects/stringlib/formatter.h')
-rw-r--r-- | Objects/stringlib/formatter.h | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h index 8e2b8ef..ee0971d 100644 --- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -768,12 +768,8 @@ FORMAT_STRING(PyObject* value, PyObject* args) PyObject *result = NULL; InternalFormatSpec format; - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) + if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", &format_spec)) goto done; - if (!STRINGLIB_CHECK(format_spec)) { - PyErr_SetString(PyExc_TypeError, STRINGLIB_TYPE_NAME " object required"); - goto done; - } /* check for the special case of zero length format spec, make it equivalent to str(value) */ @@ -843,12 +839,8 @@ FORMAT_LONG(PyObject* value, PyObject* args) PyObject *tmp = NULL; InternalFormatSpec format; - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!STRINGLIB_CHECK(format_spec)) { - PyErr_SetString(PyExc_TypeError, STRINGLIB_TYPE_NAME " object required"); + if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", &format_spec)) goto done; - } /* check for the special case of zero length format spec, make it equivalent to str(value) */ @@ -917,12 +909,8 @@ FORMAT_FLOAT(PyObject *value, PyObject *args) PyObject *tmp = NULL; InternalFormatSpec format; - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!STRINGLIB_CHECK(format_spec)) { - PyErr_SetString(PyExc_TypeError, STRINGLIB_TYPE_NAME " object required"); + if (!PyArg_ParseTuple(args, STRINGLIB_PARSE_CODE ":__format__", &format_spec)) goto done; - } /* check for the special case of zero length format spec, make it equivalent to str(value) */ |