New submission from kftse <kftse20031...@gmail.com>:

Test case:

try:
    raise TypeError()
except TypeError or ValueError:
    print("OK")
try:
    raise ValueError()
except TypeError or ValueError:
    print("OK")

Output:
(Python 3.9.0)
OK
OK
# seem to eventually lead to segmentation fault elsewhere
(Python 3.8.0)
OK
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    raise ValueError()
ValueError


I understand that this code is incorrect syntax for exception.

The awkward behavior is that the interpreter accepted this syntax and the 
output being correct in some case, or even in both cases, but seem to 
eventually lead to segmentation fault elsewhere.

----------
components: Interpreter Core
messages: 400710
nosy: kftse20031207
priority: normal
severity: normal
status: open
title: Undefined behavior for syntax "except AError or BError:" accepted by 
interpreter
type: behavior
versions: Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45058>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to