New submission from Igor <[EMAIL PROTECTED]>: I have discovered the following behaviour in 2.5, which I cannot explain:
>>> try: ... raise ValueError("foo") ... except object: ... print "aiee!" ... Traceback (most recent call last): File "<stdin>", line 2, in <module> ValueError: foo >>> sys.version '2.5.1 (r251:54863, Jan 23 2008, 16:53:41) \n[GCC 4.2.2 (Gentoo 4.2.2 p1.0)]' >>> isinstance(ValueError("foo"), object) True At first I thought I misunderstood something about exceptions, but the wording of the try-statement leads me to believe that this should work. ValueError is a subclass of object and thus, I think, should be a match, thus catching the exception. I realize that all exceptions should inherit from Exception (BaseException?), but for the sake of consistence, shouldn't "except object" catch *anything* in python 2.5? I.e. be the equivalent of "except:". Is this a bug? If so, should this be fixed? ---------- components: None messages: 63538 nosy: zotbar1234 severity: normal status: open title: Catching all exceptions with 'object' type: behavior versions: Python 2.5 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2291> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com