@@ -9206,11 +9206,11 @@ formatteriter_next(formatteriterobject *it)
92069206 PyObject * field_name_str = NULL ;
92079207 PyObject * format_spec_str = NULL ;
92089208 PyObject * conversion_str = NULL ;
9209- PyObject * result = NULL ;
9209+ PyObject * tuple = NULL ;
92109210
92119211 is_markup_bool = PyBool_FromLong (is_markup );
92129212 if (!is_markup_bool )
9213- goto error ;
9213+ return NULL ;
92149214
92159215 if (is_markup ) {
92169216 /* field_name, format_spec, and conversion are
@@ -9251,22 +9251,16 @@ formatteriter_next(formatteriterobject *it)
92519251 Py_INCREF (format_spec_str );
92529252 Py_INCREF (conversion_str );
92539253 }
9254- /* return a tuple of values */
9255- result = PyTuple_Pack (5 , is_markup_bool , literal_str ,
9256- field_name_str , format_spec_str ,
9257- conversion_str );
9258- if (result == NULL )
9259- goto error ;
9260-
9261- return result ;
9254+ tuple = PyTuple_Pack (5 , is_markup_bool , literal_str ,
9255+ field_name_str , format_spec_str ,
9256+ conversion_str );
92629257 error :
92639258 Py_XDECREF (is_markup_bool );
92649259 Py_XDECREF (literal_str );
92659260 Py_XDECREF (field_name_str );
92669261 Py_XDECREF (format_spec_str );
92679262 Py_XDECREF (conversion_str );
9268- Py_XDECREF (result );
9269- return NULL ;
9263+ return tuple ;
92709264 }
92719265}
92729266
@@ -9308,10 +9302,11 @@ PyTypeObject PyFormatterIter_Type = {
93089302};
93099303
93109304PyObject *
9311- _unicodeformatter_iterator (PyObject * str )
9305+ _PyUnicode_FormatterIterator (PyObject * str )
93129306{
93139307 formatteriterobject * it ;
93149308
9309+ assert (PyUnicode_Check (str ));
93159310 it = PyObject_New (formatteriterobject , & PyFormatterIter_Type );
93169311 if (it == NULL )
93179312 return NULL ;
@@ -9440,21 +9435,24 @@ static PyTypeObject PyFieldNameIter_Type = {
94409435 0 };
94419436
94429437PyObject *
9443- _unicodeformatter_field_name_split (PyObject * field_name )
9438+ _PyUnicode_FormatterFieldNameSplit (PyObject * field_name )
94449439{
94459440 SubString first ;
94469441 Py_ssize_t first_idx ;
94479442 fieldnameiterobject * it ;
94489443
94499444 PyObject * first_obj = NULL ;
9450- PyObject * it_obj = NULL ;
9451- PyObject * result ;
9445+ PyObject * result = NULL ;
94529446
9447+ assert (PyUnicode_Check (field_name ));
94539448 it = PyObject_New (fieldnameiterobject , & PyFieldNameIter_Type );
94549449 if (it == NULL )
9455- goto error ;
9456- it -> str = NULL ;
9457- it_obj = (PyObject * )it ;
9450+ return NULL ;
9451+
9452+ /* take ownership, give the object to the iterator. this is
9453+ just to keep the field_name alive */
9454+ Py_INCREF (field_name );
9455+ it -> str = field_name ;
94589456
94599457 if (!field_name_split (STRINGLIB_STR (field_name ),
94609458 STRINGLIB_LEN (field_name ),
@@ -9470,21 +9468,13 @@ _unicodeformatter_field_name_split(PyObject *field_name)
94709468 if (first_obj == NULL )
94719469 goto error ;
94729470
9473- /* take ownership, give the object to the iterator. this is
9474- just to keep the field_name alive */
9475- Py_INCREF (field_name );
9476- it -> str = field_name ;
9477-
94789471 /* return a tuple of values */
9479- result = PyTuple_Pack (2 , first_obj , it_obj );
9480- if (result == NULL )
9481- goto error ;
9472+ result = PyTuple_Pack (2 , first_obj , it );
94829473
9483- return result ;
94849474error :
9485- Py_XDECREF (it_obj );
9475+ Py_XDECREF (it );
94869476 Py_XDECREF (first_obj );
9487- return NULL ;
9477+ return result ;
94889478}
94899479
94909480/********************* Unicode Iterator **************************/
0 commit comments