[issue12064] unexpected behavior with exception variable

Santoso Wijaya report at bugs.python.org
Thu May 12 20:16:36 CEST 2011


Santoso Wijaya <santoso.wijaya at gmail.com> added the comment:

Looks like a regression from 2.x.

On 2.7:
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> e = True
>>> try: raise Exception()
... except Exception as e: pass
...
>>> print repr(e)
Exception()

On 3.2:
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> e = True
>>> try: raise Exception()
... except Exception as e: pass
...
>>> print(repr(e))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'e' is not defined

----------
nosy: +santa4nt
versions: +Python 3.1, Python 3.3

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


More information about the Python-bugs-list mailing list