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.

Author cvrebert
Recipients acooke, cvrebert, daniel.urban, eric.araujo
Date 2011-05-24.02:45:07
SpamBayes Score 1.5237797e-08
Marked as misclassified No
Message-id <1306205108.69.0.954360202278.issue12029@psf.upfronthosting.co.za>
In-reply-to
Content
Surveying the docs, the current behavior *is* /technically/ correct (in a suspiciously precise way) according to the Language Reference:
http://docs.python.org/dev/reference/compound_stmts.html#grammar-token-try_stmt :
"For an except clause with an expression [...] the clause matches the exception if the resulting object is 'compatible' with the exception. An object is compatible with an exception if it is the class or a base class of the exception object" (which exactly describes what PyType_IsSubtype() checks for)

The Tutorial is by contrast much more vague:
http://docs.python.org/dev/tutorial/errors.html#handling-exceptions :
"if [the raised exception's] type matches the exception named after the except keyword, the except clause is executed, and then execution continues after the try statement."
No definition of what it means for the types to "match" seems to be given.
History
Date User Action Args
2011-05-24 02:45:08cvrebertsetrecipients: + cvrebert, acooke, eric.araujo, daniel.urban
2011-05-24 02:45:08cvrebertsetmessageid: <1306205108.69.0.954360202278.issue12029@psf.upfronthosting.co.za>
2011-05-24 02:45:08cvrebertlinkissue12029 messages
2011-05-24 02:45:07cvrebertcreate