Canonicalize nested template format specs in annotations (#9076)

Use the existing f-string body unparser for template interpolation format specs, while preserving the outer interpolation source text. Add compile-only Python annotation-constant coverage.

Assisted-by: OpenAI Codex:model identifier unavailable
This commit is contained in:
youknowdot authored and GitHub committed 2026-10-11 09:17:01 +09:00
1 parent 1cbae85e20
commit 8d27253fa2
2 files changed
+13 -1

No files matched your search

+1 -1
View File
@@ -814,7 +814,7 @@ impl<'a, 'b, 'c> Unparser<'a, 'b, 'c> {
if let Some(format_spec) = &interpolation.format_spec {
self.p(":")?;
self.unparse_tstring_body(&format_spec.elements)?;
self.unparse_fstring_body(&format_spec.elements)?;
}
self.p("}")