Hug closing } when f-string expression has a format specifier (#18704)

This commit is contained in:
Micha Reiser 2025-06-17 07:39:42 +02:00 committed by GitHub
parent 2b731d19b9
commit c22f809049
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 323 additions and 198 deletions

View file

@ -50,7 +50,7 @@ impl<'a, 'src> StringNormalizer<'a, 'src> {
if let InterpolatedStringState::InsideInterpolatedElement(parent_context) =
self.context.interpolated_string_state()
{
let parent_flags = parent_context.interpolated_string().flags();
let parent_flags = parent_context.flags();
if !parent_flags.is_triple_quoted() || string.flags().is_triple_quoted() {
// This logic is even necessary when using preserve and the target python version doesn't support PEP701 because
// we might end up joining two f-strings that have different quote styles, in which case we need to alternate the quotes