[New-bugs-announce] [issue40621] Python crashes with new parser on invalid exception handlers
Shantanu
report at bugs.python.org
Thu May 14 03:40:23 EDT 2020
New submission from Shantanu <hauntsaninja at gmail.com>:
```
~/dev/cpython master λ ./python.exe --version --version
Python 3.9.0a6+ (heads/master:a15c9b3a05, May 14 2020, 00:31:47)
[Clang 11.0.0 (clang-1100.0.33.17)]
# should raise a syntax error, instead crashes
~/dev/cpython master λ cat test.py
try:
1 / 0
except Exception as a.b:
pass
~/dev/cpython master λ ./python.exe test.py
[1] 63986 bus error ./python.exe test.py
~/dev/cpython master λ ./python.exe -Xoldparser test.py
File "/Users/shantanu/dev/cpython/test.py", line 3
except Exception as a.b:
^
SyntaxError: invalid syntax
# should raise a syntax error, instead passes
~/dev/cpython master λ cat test2.py
try:
1 / 0
except Exception as (a):
pass
~/dev/cpython master λ ./python.exe test2.py
~/dev/cpython master λ ./python.exe -Xoldparser test2.py
File "/Users/shantanu/dev/cpython/test2.py", line 3
except Exception as (a):
^
SyntaxError: invalid syntax
# should raise a syntax error, instead crashes
~/dev/cpython master λ cat test3.py
try:
1 / 0
except Exception as a[0]:
pass
~/dev/cpython master λ ./python.exe test3.py
[1] 64206 bus error ./python.exe test3.py
~/dev/cpython master λ ./python.exe -Xoldparser test3.py
File "/Users/shantanu/dev/cpython/test3.py", line 3
except Exception as a[0]:
^
SyntaxError: invalid syntax
```
The old grammar expects a NAME here, but the new grammar attempts to use a target (https://docs.python.org/3/reference/grammar.html). Seems like we should just go back to using NAME.
----------
messages: 368818
nosy: hauntsaninja
priority: normal
severity: normal
status: open
title: Python crashes with new parser on invalid exception handlers
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40621>
_______________________________________
More information about the New-bugs-announce
mailing list