Skip to content

Conversation

BobTheBuidler
Copy link
Contributor

if a variable is Final but the value is not yet known at compile-time, and that variable is used as an input to an f-string, the f-string will incorrectly contain "None"

Fixes mypyc#1140

if a variable is Final but the value is not yet known at compile-time, and that variable is used as an input to an f-string, the f-string will incorrectly contain "None"
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! It would be good to have a run test for this as well.

@BobTheBuidler
Copy link
Contributor Author

Done

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks, looks like a similar thing might happen in strconv.py (which is minor)

@hauntsaninja hauntsaninja merged commit dce8e1c into python:master Sep 16, 2025
13 checks passed
KevinRK29 pushed a commit that referenced this pull request Sep 16, 2025
if a variable is Final but the value is not yet known at compile-time,
and that variable is used as an input to an f-string, the f-string will
incorrectly contain "None"

Fixes [mypyc#1140](mypyc/mypyc#1140)

(cherry picked from commit dce8e1c)
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.

BUG: inappropriate Nones in f-strings
3 participants