mirror of
https://github.com/W3SLAV/micropython.git
synced 2025-06-20 12:35:34 -04:00

In CPython 3.12 these invalid str/bytes/fstring escapes will issue a SyntaxWarning, and so differ to MicroPython. Signed-off-by: Damien George <damien@micropython.org>
14 lines
316 B
Python
14 lines
316 B
Python
# PEP-0498 specifies that '\\' and '#' must be disallowed explicitly, whereas
|
|
# MicroPython relies on the syntax error as a result of the substitution.
|
|
|
|
print(f"\\")
|
|
print(f"#")
|
|
try:
|
|
eval("f'{\}'")
|
|
except SyntaxError:
|
|
print("SyntaxError")
|
|
try:
|
|
eval("f'{#}'")
|
|
except SyntaxError:
|
|
print("SyntaxError")
|