diff Objects/typeobject.c @ 20489:e09fb4848765 legacy-trunk

slot_sq_item(): ensure that self is an instance of the wrapper's d_type before calling the wrapped function. fixup_slot_dispatchers(): fix indentation.
author Guido van Rossum <guido@python.org>
date Wed, 17 Oct 2001 07:15:43 +0000
parents 4f71dcfd0a93
children a0c8c2e5a44d
line wrap: on
line diff
--- a/Objects/typeobject.c	Wed Oct 17 06:45:56 2001 +0000
+++ b/Objects/typeobject.c	Wed Oct 17 07:15:43 2001 +0000
@@ -2908,7 +2908,8 @@
 		if (func->ob_type == &PyWrapperDescr_Type) {
 			PyWrapperDescrObject *wrapper =
 				(PyWrapperDescrObject *)func;
-			if (wrapper->d_base->wrapper == wrap_sq_item) {
+			if (wrapper->d_base->wrapper == wrap_sq_item &&
+			    PyType_IsSubtype(self->ob_type, wrapper->d_type)) {
 				intargfunc f;
 				f = (intargfunc)(wrapper->d_wrapped);
 				return f(self, i);
@@ -3938,9 +3939,10 @@
 			if (descr->ob_type == &PyWrapperDescr_Type) {
 				d = (PyWrapperDescrObject *)descr;
 				if (d->d_base->wrapper == p->wrapper &&
-					PyType_IsSubtype(type, d->d_type)) {
+				    PyType_IsSubtype(type, d->d_type))
+				{
 					if (specific == NULL ||
-						specific == d->d_wrapped)
+					    specific == d->d_wrapped)
 						specific = d->d_wrapped;
 					else
 						use_generic = 1;