@@ -284,58 +284,58 @@ If the predicate is None, 'lambda x: bool(x)' is assumed.\n\
284284static PyObject *
285285builtin_format (PyObject * self , PyObject * args )
286286{
287- static PyObject * format_str = NULL ;
288- PyObject * value ;
289- PyObject * spec = NULL ;
290- PyObject * meth ;
291- PyObject * empty = NULL ;
292- PyObject * result = NULL ;
293-
294- /* Initialize cached value */
295- if (format_str == NULL ) {
296- /* Initialize static variable needed by _PyType_Lookup */
297- format_str = PyUnicode_FromString ("__format__" );
298- if (format_str == NULL )
299- goto done ;
300- }
301-
302- if (!PyArg_ParseTuple (args , "O|U:format" , & value , & spec ))
303- goto done ;
304-
305- /* initialize the default value */
306- if (spec == NULL ) {
307- empty = PyUnicode_FromUnicode (NULL , 0 );
308- spec = empty ;
309- }
310-
311- /* Make sure the type is initialized. float gets initialized late */
312- if (Py_Type (value )-> tp_dict == NULL )
313- if (PyType_Ready (Py_Type (value )) < 0 )
314- goto done ;
315-
316- /* Find the (unbound!) __format__ method (a borrowed reference) */
317- meth = _PyType_Lookup (Py_Type (value ), format_str );
318- if (meth == NULL ) {
319- PyErr_Format (PyExc_TypeError ,
320- "Type %.100s doesn't define __format__" ,
321- Py_Type (value )-> tp_name );
322- goto done ;
323- }
324-
325- /* And call it, binding it to the value */
326- result = PyObject_CallFunctionObjArgs (meth , value , spec , NULL );
327-
328- if (result && !PyUnicode_Check (result )) {
329- PyErr_SetString (PyExc_TypeError ,
330- "__format__ method did not return string" );
331- Py_DECREF (result );
332- result = NULL ;
333- goto done ;
334- }
287+ static PyObject * format_str = NULL ;
288+ PyObject * value ;
289+ PyObject * spec = NULL ;
290+ PyObject * meth ;
291+ PyObject * empty = NULL ;
292+ PyObject * result = NULL ;
293+
294+ /* Initialize cached value */
295+ if (format_str == NULL ) {
296+ /* Initialize static variable needed by _PyType_Lookup */
297+ format_str = PyUnicode_FromString ("__format__" );
298+ if (format_str == NULL )
299+ goto done ;
300+ }
301+
302+ if (!PyArg_ParseTuple (args , "O|U:format" , & value , & spec ))
303+ goto done ;
304+
305+ /* initialize the default value */
306+ if (spec == NULL ) {
307+ empty = PyUnicode_FromUnicode (NULL , 0 );
308+ spec = empty ;
309+ }
310+
311+ /* Make sure the type is initialized. float gets initialized late */
312+ if (Py_Type (value )-> tp_dict == NULL )
313+ if (PyType_Ready (Py_Type (value )) < 0 )
314+ goto done ;
315+
316+ /* Find the (unbound!) __format__ method (a borrowed reference) */
317+ meth = _PyType_Lookup (Py_Type (value ), format_str );
318+ if (meth == NULL ) {
319+ PyErr_Format (PyExc_TypeError ,
320+ "Type %.100s doesn't define __format__" ,
321+ Py_Type (value )-> tp_name );
322+ goto done ;
323+ }
324+
325+ /* And call it, binding it to the value */
326+ result = PyObject_CallFunctionObjArgs (meth , value , spec , NULL );
327+
328+ if (result && !PyUnicode_Check (result )) {
329+ PyErr_SetString (PyExc_TypeError ,
330+ "__format__ method did not return string" );
331+ Py_DECREF (result );
332+ result = NULL ;
333+ goto done ;
334+ }
335335
336336done :
337- Py_XDECREF (empty );
338- return result ;
337+ Py_XDECREF (empty );
338+ return result ;
339339}
340340
341341PyDoc_STRVAR (format_doc ,
0 commit comments