Skip to content

Conversation

hauntsaninja
Copy link
Collaborator

Fixes #4350

Copy link

github-actions bot commented May 16, 2024

diff-shades reports zero changes comparing this PR (7f16616) to main (9c1fd46).


What is this? | Workflow run | diff-shades documentation

and any(
"\\" not in str(child)
for child in node.children
if node.type == syms.fstring_replacement_field
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if node.type == syms.fstring_replacement_field
if child.type == syms.fstring_replacement_field

@tusharsadhwani
Copy link
Collaborator

tusharsadhwani commented Jul 2, 2024

Personally I'd rewrite it like so:

if (
    "\\" in string_leaf.value
    and any(
        "\\" in str(child)
        for child in node.children
        if child.type == syms.fstring_replacement_field
    )
):
    # string normalization doesn't account for nested quotes,
    # causing breakages. skip normalization when nested quotes exist
    yield from self.visit_default(string_leaf)
    return
yield from self.visit_STRING(string_leaf)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"EOF in multi-line string" on string containing same quote nested in f-string
2 participants