summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-17 07:15:43 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-17 07:15:43 (GMT)
commitcaf59043d14254c8c4e47070d844e678487ece43 (patch)
tree6065945176a05a1a45ca34369a9c45fd2b7caa2a
parentbcbdc95e90794794081927b81006ce8563974969 (diff)
downloadcpython-caf59043d14254c8c4e47070d844e678487ece43.zip
cpython-caf59043d14254c8c4e47070d844e678487ece43.tar.gz
cpython-caf59043d14254c8c4e47070d844e678487ece43.tar.bz2
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.
-rw-r--r--Objects/typeobject.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 363c562..46fc2c6 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2908,7 +2908,8 @@ slot_sq_item(PyObject *self, int i)
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 @@ fixup_slot_dispatchers(PyTypeObject *type)
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;