File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed 
Misc/NEWS.d/next/Core_and_Builtins Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1586,6 +1586,7 @@ def check(test):
15861586        check ('[[1, 2] [f"{x}"]]' )
15871587        check ('[[1, 2] [f"x={x}"]]' )
15881588        check ('[[1, 2] ["abc"]]' )
1589+         msg = r'indices must be integers or slices, not string.templatelib.Template;' 
15891590        check ('[[1, 2] [t"{x}"]]' )
15901591        check ('[[1, 2] [t"x={x}"]]' )
15911592        msg = r'indices must be integers or slices, not' 
Original file line number Diff line number Diff line change 1+ Fix type name shown in :exc: `SyntaxWarning `\s  involving :ref: `template string 
2+ literals <t-strings>`. Patch by Brian Schubert.
Original file line number Diff line number Diff line change 2929#include  "pycore_symtable.h"       // PySTEntryObject 
3030#include  "pycore_unicodeobject.h"  // _PyUnicode_EqualToASCIIString 
3131#include  "pycore_ceval.h"          // SPECIAL___ENTER__ 
32+ #include  "pycore_template.h"       // _PyTemplate_Type 
3233
3334#define  NEED_OPCODE_METADATA 
3435#include  "pycore_opcode_metadata.h"  // _PyOpcode_opcode_metadata, _PyOpcode_num_popped/pushed 
@@ -3617,10 +3618,11 @@ infer_type(expr_ty e)
36173618        return  & PyGen_Type ;
36183619    case  Lambda_kind :
36193620        return  & PyFunction_Type ;
3620-     case  JoinedStr_kind :
36213621    case  TemplateStr_kind :
3622-     case  FormattedValue_kind :
36233622    case  Interpolation_kind :
3623+         return  & _PyTemplate_Type ;
3624+     case  JoinedStr_kind :
3625+     case  FormattedValue_kind :
36243626        return  & PyUnicode_Type ;
36253627    case  Constant_kind :
36263628        return  Py_TYPE (e -> v .Constant .value );
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments