This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author afg984
Recipients afg984
Date 2016-11-02.14:58:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
PEP 498 says: (

Scanning an f-string for expressions happens after escape sequences are decoded. Because hex(ord('{')) == 0x7b , the f-string f'\u007b4*10}' is decoded to f'{4*10}' , which evaluates as the integer 40:

    >>> f'\u007b4*10}'

However, in python3.6.0b3, the '{' from '\u007b4' does not start an expression, making the remaining '}' invalid:

    >>> f'\u007b4*10}'
      File "<stdin>", line 1
    SyntaxError: f-string: single '}' is not allowed

There's even a test case for it: (Lib/test/

    def test_no_escapes_for_braces(self):
        # \x7b is '{'.  Make sure it doesn't start an expression.
        self.assertEqual(f'\x7b2}}', '{2}')
        self.assertEqual(f'\x7b2', '{2')
        self.assertEqual(f'\u007b2', '{2')
        self.assertEqual(f'\N{LEFT CURLY BRACKET}2\N{RIGHT CURLY BRACKET}', '{2}')
Date User Action Args
2016-11-02 14:58:03afg984setrecipients: + afg984
2016-11-02 14:58:03afg984setmessageid: <>
2016-11-02 14:58:03afg984linkissue28590 messages
2016-11-02 14:58:03afg984create