@@ -1216,7 +1216,10 @@ def _enter_annotation(self, ann_type=AnnotationState.BARE):
1216
1216
def _in_postponed_annotation (self ):
1217
1217
return (
1218
1218
self ._in_annotation == AnnotationState .STRING or
1219
- self .annotationsFutureEnabled
1219
+ (
1220
+ self ._in_annotation == AnnotationState .BARE and
1221
+ (self .annotationsFutureEnabled or sys .version_info >= (3 , 14 ))
1222
+ )
1220
1223
)
1221
1224
1222
1225
def handleChildren (self , tree , omit = None ):
@@ -1350,7 +1353,7 @@ def handleAnnotation(self, annotation, node):
1350
1353
annotation .col_offset ,
1351
1354
messages .ForwardAnnotationSyntaxError ,
1352
1355
))
1353
- elif self .annotationsFutureEnabled :
1356
+ elif self .annotationsFutureEnabled or sys . version_info >= ( 3 , 14 ) :
1354
1357
self .handle_annotation_always_deferred (annotation , node )
1355
1358
else :
1356
1359
self .handleNode (annotation , node )
@@ -1776,6 +1779,20 @@ def JOINEDSTR(self, node):
1776
1779
finally :
1777
1780
self ._in_fstring = orig
1778
1781
1782
+ def TEMPLATESTR (self , node ):
1783
+ if not any (isinstance (x , ast .Interpolation ) for x in node .values ):
1784
+ self .report (messages .TStringMissingPlaceholders , node )
1785
+
1786
+ # similar to f-strings, conversion / etc. flags are parsed as f-strings
1787
+ # without placeholders
1788
+ self ._in_fstring , orig = True , self ._in_fstring
1789
+ try :
1790
+ self .handleChildren (node )
1791
+ finally :
1792
+ self ._in_fstring = orig
1793
+
1794
+ INTERPOLATION = handleChildren
1795
+
1779
1796
def DICT (self , node ):
1780
1797
# Complain if there are duplicate keys with different values
1781
1798
# If they have the same value it's not going to cause potentially
0 commit comments