This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author oleksandr.suvorov
Recipients oleksandr.suvorov
Date 2020-05-22.10:59:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590145151.0.0.634189101704.issue40728@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2020-05-22 10:59:11oleksandr.suvorovsetrecipients: + oleksandr.suvorov
2020-05-22 10:59:11oleksandr.suvorovsetmessageid: <1590145151.0.0.634189101704.issue40728@roundup.psfhosted.org>
2020-05-22 10:59:10oleksandr.suvorovlinkissue40728 messages
2020-05-22 10:59:10oleksandr.suvorovcreate