[issue2291] Catching all exceptions with 'object'

Alexander Belopolsky report at bugs.python.org
Sat Mar 15 03:59:02 CET 2008


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

Py3k behavior seems to be better:

Python 3.0a2+ (py3k:61137M, Feb 29 2008, 15:17:29) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
>>> try:    
...   raise ValueError("foo")
... except object:
...   pass
... 
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
TypeError: catching classes that do not inherit from BaseException is 
not allowed

Something needs to be done for 2.6: at the minimum a warning should be 
issued under -3 option.

----------
nosy: +belopolsky

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


More information about the Python-bugs-list mailing list