File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -573,6 +573,7 @@ def _template_to_ast(template):
573573 values .append (ast .Constant (value = part ))
574574 case _: # Interpolation, but we don't want to import the string module
575575 interp = ast .Interpolation (
576+ str = part .expression ,
576577 value = ast .parse (part .expression ),
577578 conversion = ord (part .conversion ) if part .conversion is not None else - 1 ,
578579 format_spec = (
Original file line number Diff line number Diff line change @@ -281,6 +281,7 @@ def f(
281281 z : t "{a:b} {c!r} {d!s:t}" ,
282282 a : t "a{b}c{d}e{f}g" ,
283283 b : t "{a:{1}}" ,
284+ c : t "{a | b * c}" ,
284285 ): pass
285286
286287 annos = get_annotations (f , format = Format .STRING )
@@ -291,6 +292,7 @@ def f(
291292 "a" : "t'a{b}c{d}e{f}g'" ,
292293 # interpolations in the format spec are eagerly evaluated so we can't recover the source
293294 "b" : "t'{a:1}'" ,
295+ "c" : "t'{a | b * c}'" ,
294296 })
295297
296298 def g (
You can’t perform that action at this time.
0 commit comments