Skip to content

Commit 84bc5b4

Browse files
committed
fix warning, one more test
1 parent 242387c commit 84bc5b4

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Lib/annotationlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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=(

Lib/test/test_annotationlib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)