[issue12064] unexpected behavior with exception variable
Changes by Mark Dickinson dicki...@gmail.com: -- superseder: - except-as in Py3 eats variables ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12064] unexpected behavior with exception variable
New submission from Mathias Svensson frea...@freaken.dk: Current behavior: In the very simple attached example an existing variable-name is used as the target in the except-part of a try-statement. The existing variable is deleted if an exception is throw. Excepted behavior: The only reasonable behaviors are keeping the original variable or keeping the exception. The current behavior is very unintuitive. -- components: Interpreter Core files: test.py messages: 135845 nosy: Mathias.Svensson priority: normal severity: normal status: open title: unexpected behavior with exception variable type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file21984/test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12064] unexpected behavior with exception variable
Eric Snow ericsnowcurren...@gmail.com added the comment: Duplicate of issue8130. When an exception has been assigned using as target, it is cleared at the end of the except clause. [1] See: [1] http://docs.python.org/py3k/reference/compound_stmts.html#the-try-statement [2] http://www.python.org/dev/peps/pep-3110/#semantic-changes (discussed in issue4617) -- nosy: +ericsnow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12064] unexpected behavior with exception variable
Santoso Wijaya santoso.wij...@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 rep...@bugs.python.org http://bugs.python.org/issue12064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12064] unexpected behavior with exception variable
Ezio Melotti ezio.melo...@gmail.com added the comment: Closing as duplicate. -- nosy: +ezio.melotti resolution: - duplicate stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com