Skip to content
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

DeprecationWarning when escaping curly braces in an f-string #105938

Closed
lysnikolaou opened this issue Jun 20, 2023 · 0 comments
Closed

DeprecationWarning when escaping curly braces in an f-string #105938

lysnikolaou opened this issue Jun 20, 2023 · 0 comments
Assignees
Labels
type-bug An unexpected behavior, bug, or error

Comments

@lysnikolaou
Copy link
Contributor

lysnikolaou commented Jun 20, 2023

Bug report

A DeprecationWarning is emitted when escaping a curly brace in an f-string. The correct warning is a SyntaxWarning as of Python 3.12.

cpython ontest-fstring-syntaxwarnings [$] via C v14.0.3-clang via 🐍 pyenv 3.11.3 took 15s 
❯ ./python.exe
Python 3.13.0a0 (heads/main:155577de1b, Jun 20 2023, 13:50:50) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '\h'
<stdin>:1: SyntaxWarning: invalid escape sequence '\h'
'\\h'
>>> f'\h'
<stdin>:1: SyntaxWarning: invalid escape sequence '\h'
'\\h'
>>> '\{'
<stdin>:1: SyntaxWarning: invalid escape sequence '\{'
'\\{'
>>> f'\{{'
<stdin>:1: DeprecationWarning: invalid escape sequence '\{'
<stdin>:1: SyntaxWarning: invalid escape sequence '\{'
'\\{'

Linked PRs

@lysnikolaou lysnikolaou added the type-bug An unexpected behavior, bug, or error label Jun 20, 2023
@lysnikolaou lysnikolaou self-assigned this Jun 20, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 20, 2023
…ng (pythonGH-105939)

(cherry picked from commit 6586cee)

Co-authored-by: Lysandros Nikolaou <[email protected]>
lysnikolaou added a commit that referenced this issue Jun 20, 2023
…ing (GH-105939) (#105941)

(cherry picked from commit 6586cee)

Co-authored-by: Lysandros Nikolaou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant