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);
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;