Ok, I've now further narrowed down this isinstance issue:
python22-maint ==> bug does not appear python22-maint with abstract.c from Python 2.2.1 ==> bug appears
So for what it's worth (i. e. not much), I'd say please /do/ include the abstract.c changes into the upcoming Python 2.2.2 :-)
I'm sure it's this change, which was backported to the 2.2 maintenance branch (and hence will be in 2.2.2). It fixes several several occurrences where an error is not cleared.
---------------------------- revision 2.101 date: 2002/04/23 22:45:44; author: bwarsaw; state: Exp; lines: +46 -9 abstract_get_bases(): Clarify exactly what the return values and states can be for this function, and ensure that only AttributeErrors are masked. Any other exception raised via the equivalent of getattr(cls, '__bases__') should be propagated up.
abstract_issubclass(): If abstract_get_bases() returns NULL, we must call PyErr_Occurred() to see if an exception is being propagated, and return -1 or 0 as appropriate. This is the specific fix for a problem whereby if getattr(derived, '__bases__') raised an exception, an "undetected error" would occur (under a debug build). This nasty situation was uncovered when writing a security proxy extension type for the Zope3 project, where the security proxy raised a Forbidden exception on getattr of __bases__.
PyObject_IsInstance(), PyObject_IsSubclass(): After both calls to abstract_get_bases(), where we're setting the TypeError if the return value is NULL, we must first check to see if an exception occurred, and /not/ mask an existing exception.
Neil Schemenauer should double check that these changes don't break his ExtensionClass examples (there aren't any test cases for those examples and abstract_get_bases() was added by him in response to problems with ExtensionClass). Neil, please add test cases if possible!
I belive this is a bug fix candidate for Python 2.2.2. ----------------------------
--Guido van Rossum (home page: http://www.python.org/%7Eguido/)