Staging
v0.5.1
https://github.com/python/cpython
Revision eab1a0b9bd86c54133607028a8c6940377fdbb85 authored by Michael W. Hudson on 24 September 2002, 11:08:23 UTC, committed by Michael W. Hudson on 24 September 2002, 11:08:23 UTC
    revision 2.101 of abstract.c

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.

----

Whitespace normalization made this a pest to backport...

Did a test case ever get added for this?
1 parent bd5ba4b
History
Tip revision: eab1a0b9bd86c54133607028a8c6940377fdbb85 authored by Michael W. Hudson on 24 September 2002, 11:08:23 UTC
backport bwarsaw's checkin of
Tip revision: eab1a0b
File Mode Size
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
RISCOS
Tools
.cvsignore -rw-r--r-- 109 bytes
.hgtags -rw-r--r-- 2.3 KB
LICENSE -rw-r--r-- 12.2 KB
Makefile.pre.in -rw-r--r-- 25.9 KB
PLAN.txt -rw-r--r-- 14.1 KB
README -rw-r--r-- 41.7 KB
acconfig.h -rw-r--r-- 7.5 KB
configure -rwxr-xr-x 209.6 KB
configure.in -rw-r--r-- 54.5 KB
install-sh -rwxr-xr-x 5.5 KB
pyconfig.h.in -rw-r--r-- 19.6 KB
setup.py -rw-r--r-- 34.3 KB

README

back to top