@@ -768,12 +768,8 @@ FORMAT_STRING(PyObject* value, PyObject* args)
768768 PyObject * result = NULL ;
769769 InternalFormatSpec format ;
770770
771- if (!PyArg_ParseTuple (args , "O :__format__" , & format_spec ))
771+ if (!PyArg_ParseTuple (args , STRINGLIB_PARSE_CODE " :__format__" , & format_spec ))
772772 goto done ;
773- if (!STRINGLIB_CHECK (format_spec )) {
774- PyErr_SetString (PyExc_TypeError , STRINGLIB_TYPE_NAME " object required" );
775- goto done ;
776- }
777773
778774 /* check for the special case of zero length format spec, make
779775 it equivalent to str(value) */
@@ -843,12 +839,8 @@ FORMAT_LONG(PyObject* value, PyObject* args)
843839 PyObject * tmp = NULL ;
844840 InternalFormatSpec format ;
845841
846- if (!PyArg_ParseTuple (args , "O:__format__" , & format_spec ))
847- goto done ;
848- if (!STRINGLIB_CHECK (format_spec )) {
849- PyErr_SetString (PyExc_TypeError , STRINGLIB_TYPE_NAME " object required" );
842+ if (!PyArg_ParseTuple (args , STRINGLIB_PARSE_CODE ":__format__" , & format_spec ))
850843 goto done ;
851- }
852844
853845 /* check for the special case of zero length format spec, make
854846 it equivalent to str(value) */
@@ -917,12 +909,8 @@ FORMAT_FLOAT(PyObject *value, PyObject *args)
917909 PyObject * tmp = NULL ;
918910 InternalFormatSpec format ;
919911
920- if (!PyArg_ParseTuple (args , "O:__format__" , & format_spec ))
921- goto done ;
922- if (!STRINGLIB_CHECK (format_spec )) {
923- PyErr_SetString (PyExc_TypeError , STRINGLIB_TYPE_NAME " object required" );
912+ if (!PyArg_ParseTuple (args , STRINGLIB_PARSE_CODE ":__format__" , & format_spec ))
924913 goto done ;
925- }
926914
927915 /* check for the special case of zero length format spec, make
928916 it equivalent to str(value) */
0 commit comments