New submission from Oleksandr Suvorov <[email protected]>:
def foo(exc):
try:
1/0
except Exception as exc:
...
finally:
return exc
foo(1)
Executing the following code results in UnboundLocalError, while exc has been
defined and passed to a function explicitly.
I think this is something similar to python2 issue when list comprehensions
where overwriting local variable values, expected behaviour in here is that
foo(1) returns 1
----------
components: Interpreter Core
messages: 369588
nosy: oleksandr.suvorov
priority: normal
severity: normal
status: open
title: UnboundLocalError as a result of except statement variable re-assignment
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40728>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com