◐ Shell
clean mode source ↗

Compilation emits multiple warnings in the finally block

Bug report

This code produces two SyntaxWarnings in the new REPL:

>>> def some():
...     try:
...         return 1
...     finally:
...         return 2
...         
<python-input-14>:5: SyntaxWarning: 'return' in a 'finally' block
<python-input-14>:5: SyntaxWarning: 'return' in a 'finally' block

Image

But, in our old REPL it produces just one:

Image

Other SyntaxWarnings also do not show the same behavior in the new REPL. Example:

Image

So, looks like only PEP-765 is affected, only in the new REPL.

CC @ambv @iritkatriel

Linked PRs