• Barry Warsaw's avatar
    abstract_get_bases(): Clarify exactly what the return values and · f16951cf
    Barry Warsaw yazdı
    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.
    f16951cf
abstract.c 43.4 KB