[issue37830] continue and break in finally with return in try results with segfault
Serhiy Storchaka
report at bugs.python.org
Tue Aug 13 12:18:41 EDT 2019
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
Note, that we have a regression in 3.8. There is a use case for "break" in "finally", and such code is even used in the stdlib. And who know in what third-party code it is used. In specific circumstances (see msg349513) it now can cause a crash. Other example:
import contextlib
def simple():
with contextlib.nullcontext():
for number in range(2):
try:
return number
finally:
break
simple()
It just raise an exception in 3.8, not crash:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 7, in simple
TypeError: 'range_iterator' object is not callable
----------
stage: patch review ->
title: continue in finally with return in try results with segfault -> continue and break in finally with return in try results with segfault
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37830>
_______________________________________
More information about the Python-bugs-list
mailing list