mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Changed to use 'U' argument to PyArg_ParseTuple, instead of manually checking for unicode objects.
This commit is contained in:
parent
a95207ab3b
commit
37f10386f1
6 changed files with 16 additions and 21 deletions
|
|
@ -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))
|
||||
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) */
|
||||
|
|
@ -917,12 +909,8 @@ FORMAT_FLOAT(PyObject *value, PyObject *args)
|
|||
PyObject *tmp = 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) */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue