mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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.
This commit is contained in:
parent
bcbdc95e90
commit
caf59043d1
1 changed files with 5 additions and 3 deletions
|
@ -2908,7 +2908,8 @@ slot_sq_item(PyObject *self, int i)
|
||||||
if (func->ob_type == &PyWrapperDescr_Type) {
|
if (func->ob_type == &PyWrapperDescr_Type) {
|
||||||
PyWrapperDescrObject *wrapper =
|
PyWrapperDescrObject *wrapper =
|
||||||
(PyWrapperDescrObject *)func;
|
(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;
|
intargfunc f;
|
||||||
f = (intargfunc)(wrapper->d_wrapped);
|
f = (intargfunc)(wrapper->d_wrapped);
|
||||||
return f(self, i);
|
return f(self, i);
|
||||||
|
@ -3938,9 +3939,10 @@ fixup_slot_dispatchers(PyTypeObject *type)
|
||||||
if (descr->ob_type == &PyWrapperDescr_Type) {
|
if (descr->ob_type == &PyWrapperDescr_Type) {
|
||||||
d = (PyWrapperDescrObject *)descr;
|
d = (PyWrapperDescrObject *)descr;
|
||||||
if (d->d_base->wrapper == p->wrapper &&
|
if (d->d_base->wrapper == p->wrapper &&
|
||||||
PyType_IsSubtype(type, d->d_type)) {
|
PyType_IsSubtype(type, d->d_type))
|
||||||
|
{
|
||||||
if (specific == NULL ||
|
if (specific == NULL ||
|
||||||
specific == d->d_wrapped)
|
specific == d->d_wrapped)
|
||||||
specific = d->d_wrapped;
|
specific = d->d_wrapped;
|
||||||
else
|
else
|
||||||
use_generic = 1;
|
use_generic = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue