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: Raise a Py3K warning for catching nested tuples with non-BaseException exceptions
Type: behavior Stage: resolved
Components: Interpreter Core Versions:
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: belopolsky, benjamin.peterson, brunogola, ezio.melotti, pitrou, zach.ware
Priority: low Keywords: 26backport, easy, patch

Created on 2008-03-18 03:51 by belopolsky, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
issue2380.diff belopolsky, 2008-03-18 04:59
Messages (5)
msg63875 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2008-03-18 03:51
As of r61478, the following code fails to produce a py3k warning:

   raise ValueError
except ((ValueError,object),):

which is an error for in py3k:

Traceback (most recent call last):
  File "", line 3, in <module>
    except ((ValueError,object),):
TypeError: catching classes that do not inherit from BaseException is 
not allowed
msg66580 - (view) Author: Bruno Gola (brunogola) Date: 2008-05-10 20:02
Should nested tuples in an except clause be a valid syntax?
except ((ValueError, Exception), TypeError, (...)):

I don't see any benefit and because of this behavior the implementation
(in Python/errors.c and in the patch attached) will use recursive function. 

I think that any objects inside a tuple in an except clause should be
treated equally (as an object), even a tuple, so the except clause above
should be an error in py3k and should produce a warning because the list
objects does not inherits BaseException.

Please, see my comment in, it is
related to this issue.
msg123030 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-12-02 01:31
issue2380.diff does not apply anymore.
msg123248 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-12-03 14:09
Not all incompatibilities have to raise a py3k warnings; AFAIK, only those which are not handled by 2to3 do.
msg368051 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2020-05-04 13:55
With 2.7 out of support, closing.
Date User Action Args
2022-04-11 14:56:32adminsetgithub: 46633
2020-05-04 13:55:06zach.waresetstatus: open -> closed

nosy: + zach.ware
messages: + msg368051

resolution: out of date
stage: needs patch -> resolved
2016-09-10 18:33:23belopolskysetassignee: belopolsky ->
versions: - Python 2.6, Python 2.7
2012-08-23 17:51:12moijes12setnosy: - moijes12
2012-08-23 14:39:07moijes12setnosy: + moijes12
2010-12-03 14:09:16pitrousetnosy: + pitrou, benjamin.peterson
messages: + msg123248
2010-12-02 01:31:49belopolskysetassignee: belopolsky
messages: + msg123030
stage: needs patch
2010-06-26 22:52:38ezio.melottisetnosy: + ezio.melotti
2010-04-28 18:27:52terry.reedysetversions: + Python 2.7
2008-05-10 20:02:56brunogolasetnosy: + brunogola
messages: + msg66580
2008-03-18 04:59:04belopolskysetfiles: + issue2380.diff
keywords: + patch
2008-03-18 04:29:28gvanrossumsetpriority: low
keywords: + easy, 26backport
2008-03-18 03:51:02belopolskycreate