10000 [3.13] gh-117482: Simplify the Fix For Builtin Types Slot Wrappers by ericsnowcurrently · Pull Request #121932 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-117482: Simplify the Fix For Builtin Types Slot Wrappers #121932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not add a slot wrapper for inherited slots.
  • Loading branch information
ericsnowcurrently committed Jul 17, 2024
commit 17980402400b4a2af59412856e86cce5c423105e
9 changes: 9 additions & 0 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -10906,6 +10906,15 @@ add_operators(PyTypeObject *type)
ptr = slotptr(type, p->offset);
if (!ptr || !*ptr)
continue;
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN
&& type->tp_base != NULL)
{
void **ptr_base = slotptr(type->tp_base, p->offset);
if (ptr_base && *ptr == *ptr_base) {
/* It must have been inherited (see type_ready_inherit()).. */
continue;
}
}
int r = PyDict_Contains(dict, p->name_strobj);
if (r > 0)
continue;
Expand Down
0