-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backslash in f-string format specifier gets escape #105194
Labels
type-bug
An unexpected behavior, bug, or error
Comments
@isidentical @lysnikolaou can you take this one? |
Sure! Will probably have a look tomorrow morning. |
pablogsal
added a commit
to pablogsal/cpython
that referenced
this issue
Jun 2, 2023
@lysnikolaou I gave this a go and I think I have it. Can you check #105231 ? |
pablogsal
added a commit
to pablogsal/cpython
that referenced
this issue
Jun 2, 2023
pablogsal
added a commit
to pablogsal/cpython
that referenced
this issue
Jun 2, 2023
pablogsal
added a commit
that referenced
this issue
Jun 2, 2023
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Jun 2, 2023
…pythonGH-105231) (cherry picked from commit 41de543) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
pablogsal
pushed a commit
that referenced
this issue
Jun 2, 2023
Thanks for fixing this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Between Python 3.12 alpha 7 and beta 1 the behaviour of format specifiers containing a backslash (e.g.
\n
,\u2603
) in f-strings changed.Previously, the
__format__
method would get e.g. the newline character, but it now receives a backslash and ann
character (i.e. the string"\n"
)The following script demonstrates this:
In both cases the
format()
function works correctly - I only encounter the issue with f-strings.I suspect this is related to the PEP 701 changes to f-strings, but I couldn't find anything in the discussion of that PEP to suggest this was a deliberate change.
Your environment
Linked PRs
The text was updated successfully, but these errors were encountered: