[New-bugs-announce] [issue39601] brace escapes are not working in formatted string literal format specifications

JitterMan report at bugs.python.org
Mon Feb 10 11:48:04 EST 2020


New submission from JitterMan <pythonbugs at shalmirane.com>:

It appears as if escaping the braces by doubling them up is not working properly if the braces are in a format specification within a f-string.

>>> print(f'Email:\n    {C:{{v.name}} {{v.email}}|\n    }')                         
Traceback (most recent call last):
  File "bugreport.py", line 95, in <module>
    print(f'Email:\n    {C:{{v.name}} {{v.email}}|\n    }')
NameError: name 'v' is not defined

The escaping works as expected when the string's format method is used.

----------
components: 2to3 (2.x to 3.x conversion tool)
files: bugreport.py
messages: 361702
nosy: jitterman
priority: normal
severity: normal
status: open
title: brace escapes are not working in formatted string literal format specifications
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48887/bugreport.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39601>
_______________________________________


More information about the New-bugs-announce mailing list