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.

Title: Using an exception variable outside an 'except' clause should raise a Py3K warning
Type: behavior Stage: test needed
Components: Interpreter Core Versions: Python 2.7
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: alexandre.vassalotti, brett.cannon, brunogola, terry.reedy
Priority: normal Keywords: 26backport

Created on 2008-03-17 18:29 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg63708 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-03-17 18:29
If one tries to use an exception bound to a variable in an 'except'
clause  it should raise a Py3K warning.
msg66579 - (view) Author: Bruno Gola (brunogola) Date: 2008-05-10 20:01
see, I think that it's related.

the only reason i see for nested tuples to be valid syntax in an except
clause was:
x = ValueError
y = (TypeError, IndexError)
except (x, y):

and this will not be valid in py3k, as noticed here.
msg91340 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-08-06 00:39
Brett, could you provide an example of "an exception bound to a variable"?
msg91341 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-08-06 00:50
    raise Exception("I should not be seen")
except Exception, exc:

print exc
msg104449 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-04-28 18:25
I am assuming that this is an unfixed bug that might still be fixed in 2.7 sometime and that it should not be closed yet, so I am just updating the version.
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46598
2012-07-02 19:24:20brett.cannonsetresolution: out of date -> wont fix
2012-07-02 19:24:13brett.cannonsetstatus: open -> closed
resolution: out of date
2010-04-28 18:25:30terry.reedysetnosy: + terry.reedy

messages: + msg104449
versions: + Python 2.7, - Python 2.6
2009-08-06 00:50:05brett.cannonsetmessages: + msg91341
2009-08-06 00:39:04alexandre.vassalottisetpriority: critical -> normal

nosy: + alexandre.vassalotti
messages: + msg91340

stage: test needed
2008-05-10 20:01:44brunogolasetnosy: + brunogola
messages: + msg66579
2008-03-17 20:12:14brett.cannonsetpriority: release blocker -> critical
2008-03-17 18:29:08brett.cannoncreate