Skip to content

Conversation

tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Feb 15, 2025

For more details, see the linked issue, but the gist is:

with this PR, this is now extracted:

_(f'foo')

while this remains disallowed:

_(f'foo {x}')

Feedback welcome!

cc @StanFromIreland in case you're interested ;)

Comment on lines +419 to +421
if value is not None:
return value
return self._parse_literal_fstring(node)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if value is not None:
return value
return self._parse_literal_fstring(node)
return self._parse_literal_string(node) or self._parse_literal_fstring(node)

Copy link
Member Author

@tomasr8 tomasr8 Feb 15, 2025

Choose a reason for hiding this comment

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

self._parse_literal_string(node) could return '' which is falsey so we'd try to parse an f-string there which is not what we want

@tomasr8 tomasr8 closed this Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants