[New-bugs-announce] [issue16703] except statement turns defined variable into undefined

Serhiy Storchaka report at bugs.python.org
Mon Dec 17 20:38:45 CET 2012


New submission from Serhiy Storchaka:

Example:

>>> err = None
>>> try: raise ValueError
... except ValueError as err: pass
... 
>>> err
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'err' is not defined

It is expected that either the variable will have the catched value, or save the old value, or the compiler will raise an error. But it didn't even warns.

----------
components: Interpreter Core
messages: 177657
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: except statement turns defined variable into undefined
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16703>
_______________________________________


More information about the New-bugs-announce mailing list