@@ -700,62 +700,11 @@ append_templatestr(PyUnicodeWriter *writer, expr_ty e)
700700        return  -1 ;
701701    }
702702
703-     Py_ssize_t  last_idx  =  0 ;
704703    Py_ssize_t  len  =  asdl_seq_LEN (e -> v .TemplateStr .values );
705-     if  (len  ==  0 ) {
706-         int  result  =  _write_values_subarray (writer , e -> v .TemplateStr .values ,
707-                 0 , len  -  1 , 't' , arena );
708-         _PyArena_Free (arena );
709-         return  result ;
710-     }
711- 
712-     for  (Py_ssize_t  i  =  0 ; i  <  len ; i ++ ) {
713-         expr_ty  value  =  asdl_seq_GET (e -> v .TemplateStr .values , i );
714- 
715-         // Handle implicit concat of t-strings with f-strings 
716-         if  (value -> kind  ==  FormattedValue_kind ) {
717-             if  (i  >  last_idx ) {
718-                 // Create a new TemplateStr with the values between last_idx and i 
719-                 // and append it to the writer. 
720-                 if  (_write_values_subarray (writer , e -> v .TemplateStr .values ,
721-                         last_idx , i  -  1 , 't' , arena ) ==  -1 ) {
722-                     goto error ;
723-                 }
724- 
725-                 if  (append_charp (writer , " " ) ==  -1 ) {
726-                     goto error ;
727-                 }
728-             }
729- 
730-             // Append the FormattedValue to the writer. 
731-             if  (_write_values_subarray (writer , e -> v .TemplateStr .values ,
732-                     i , i , 'f' , arena ) ==  -1 ) {
733-                 goto error ;
734-             }
735- 
736-             if  (i  +  1  <  len ) {
737-                 if  (append_charp (writer , " " ) ==  -1 ) {
738-                     goto error ;
739-                 }
740-             }
741- 
742-             last_idx  =  i  +  1 ;
743-         }
744-     }
745- 
746-     if  (last_idx  <  len ) {
747-         if  (_write_values_subarray (writer , e -> v .TemplateStr .values ,
748-                 last_idx , len  -  1 , 't' , arena ) ==  -1 ) {
749-             goto error ;
750-         }
751-     }
752-     _PyArena_Free (arena );
753- 
754-     return  0 ;
755- 
756- error :
704+     int  result  =  _write_values_subarray (writer , e -> v .TemplateStr .values ,
705+             0 , len  -  1 , 't' , arena );
757706    _PyArena_Free (arena );
758-     return  -1 ;
707+     return  result ;
759708}
760709
761710static  int 
0 commit comments