[issue2371] Patch for catching exceptions that do not inherit from BaseException

Alexander Belopolsky report at bugs.python.org
Tue Mar 18 03:57:13 CET 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

I left the following comment in issue2291 pertaining to this patch:

"""
There is also a subtle bug in the issue2371 patch:
$ cat x.py
try:
    raise ValueError
except ((ValueError,),):
    pass

$ ./python -3 x.py
x.py:3: DeprecationWarning: catching classes that do not inherit from
BaseException is not allowed in 3.x.
  except ((ValueError,),):

I am not sure if it would be acceptable to move warnings to
PyErr_GivenExceptionMatches, but if not, the checking logic should
reproduce PyErr_GivenExceptionMatches' recursive behavior.
"""

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2371>
__________________________________


More information about the Python-bugs-list mailing list