Title: Raise a Py3K warning when raise non-BaseException exceptions
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: belopolsky, brett.cannon, gvanrossum
Priority: release blocker Keywords: 26backport, patch

Created on 2008-03-17 18:10 by brett.cannon, last changed 2008-03-18 04:27 by gvanrossum. This issue is now closed.

File name Uploaded Description Edit
issue2341.diff belopolsky, 2008-03-17 20:16 patch against revision 61449
issue2341-minor.diff belopolsky, 2008-03-17 20:31
Messages (5)
msg63700 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-03-17 18:10
Raising exceptions that do not inherit from BaseException (e.g., classic
classes) should raise a Py3K warning.
msg63754 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2008-03-17 20:16
See attached.  I don't know how to write unit tests for -3 warnings.
msg63759 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2008-03-17 20:31
While writing the patch, I noticed that "/* Normalize to raise <class>,
<instance> */" comment was misplaced.  Please consider a minor patch
that fixes that.
msg63881 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-03-18 04:04
I'll review this soon.
msg63884 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-03-18 04:27
Checked in as r61486.

I tweaked your change slightly to compare the output of PyErr_Warn()
with -1.

The "minor" patch is incorrect IMO; the code where the comment was
originally is indeed normalizing the exception in a specific way, while
code where you moved it doesn't need a comment (the function name
already says what it does :-).
Date User Action Args
2008-03-18 04:27:05gvanrossumsetstatus: open -> closed
resolution: accepted
messages: + msg63884
2008-03-18 04:04:46gvanrossumsetpriority: critical -> release blocker
assignee: gvanrossum
messages: + msg63881
nosy: + gvanrossum
2008-03-17 20:31:11belopolskysetfiles: + issue2341-minor.diff
messages: + msg63759
2008-03-17 20:16:05belopolskysetfiles: + issue2341.diff
keywords: + patch
messages: + msg63754
nosy: + belopolsky
2008-03-17 20:11:24brett.cannonsetpriority: release blocker -> critical
2008-03-17 18:10:55brett.cannoncreate