mirror of
https://github.com/python/cpython
synced 2026-09-29 11:35:29 +03:00
bpo-37619: update_one_slot() should not ignore wrapper descriptors for wrong type (GH-14836)
This commit is contained in:
parent
f958377b67
commit
57ea335606
3 changed files with 28 additions and 6 deletions
|
|
@ -7307,14 +7307,21 @@ update_one_slot(PyTypeObject *type, slotdef *p)
|
|||
if (tptr == NULL || tptr == ptr)
|
||||
generic = p->function;
|
||||
d = (PyWrapperDescrObject *)descr;
|
||||
if (d->d_base->wrapper == p->wrapper &&
|
||||
if ((specific == NULL || specific == d->d_wrapped) &&
|
||||
d->d_base->wrapper == p->wrapper &&
|
||||
PyType_IsSubtype(type, PyDescr_TYPE(d)))
|
||||
{
|
||||
if (specific == NULL ||
|
||||
specific == d->d_wrapped)
|
||||
specific = d->d_wrapped;
|
||||
else
|
||||
use_generic = 1;
|
||||
specific = d->d_wrapped;
|
||||
}
|
||||
else {
|
||||
/* We cannot use the specific slot function because either
|
||||
- it is not unique: there are multiple methods for this
|
||||
slot and they conflict
|
||||
- the signature is wrong (as checked by the ->wrapper
|
||||
comparison above)
|
||||
- it's wrapping the wrong class
|
||||
*/
|
||||
use_generic = 1;
|
||||
}
|
||||
}
|
||||
else if (Py_TYPE(descr) == &PyCFunction_Type &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue