[New-bugs-announce] [issue42986] pegen parser: Crash on SyntaxError with f-string on Windows

neonene report at bugs.python.org
Wed Jan 20 17:51:26 EST 2021


New submission from neonene <nicesalmon at gmail.com>:

On Windows, Python master crashes using f-string (which has an invalid char with braces) on line 3 and after.
It seems the issue is from commit (e5fe509054183bed9aef42c92da8407d339e8af8).

I tried

1) exec("f'{.}'")
2) exec("\nf'{.}'")
3) exec("\n\nf'{.}'")

commands and results are

1) expected
    >>> exec("f'{.}'")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<string>", line 1
        (.)
         ^
    SyntaxError: f-string: invalid syntax

2) unexpected (caret indicates nothing)
    >>> exec("\nf'{.}'")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<string>", line 2

        ^
    SyntaxError: f-string: invalid syntax

3) python crashes
    >>> exec("\n\nf'{.}'")

----------
components: Interpreter Core
messages: 385377
nosy: lys.nikolaou, neonene, pablogsal
priority: normal
severity: normal
status: open
title: pegen parser: Crash on SyntaxError with f-string on Windows
type: crash
versions: Python 3.10

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


More information about the New-bugs-announce mailing list