New submission from Alan Robertson <al...@unix.sh>:
When an exception "as" variable occurs, it deletes local variables with the same name. This is certainly surprising, and doesn't appear to be a documented behavior (but maybe I don't know where to look). The word "bug" comes to mind. The following few lines of code illustrate it nicely: def testme(): err = Exception("nothing worked") try: raise ValueError("no value") except ValueError as err: pass print(err) testme() ---------- components: Interpreter Core files: foo.py messages: 363300 nosy: alanr priority: normal severity: normal status: open title: "as" variable in except block deletes local variables with same name versions: Python 3.7 Added file: https://bugs.python.org/file48946/foo.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39841> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com