Skip to content

Commit 1a6a50e

Browse files
Do not add a slot wrapper for inherited slots.
1 parent 0eb0160 commit 1a6a50e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Objects/typeobject.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11077,6 +11077,15 @@ add_operators(PyTypeObject *type)
1107711077
ptr = slotptr(type, p->offset);
1107811078
if (!ptr || !*ptr)
1107911079
continue;
11080+
if (type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN
11081+
&& type->tp_base != NULL)
11082+
{
11083+
void **ptr_base = slotptr(type->tp_base, p->offset);
11084+
if (ptr_base && *ptr == *ptr_base) {
11085+
/* It must have been inherited (see type_ready_inherit()).. */
11086+
continue;
11087+
}
11088+
}
1108011089
int r = PyDict_Contains(dict, p->name_strobj);
1108111090
if (r > 0)
1108211091
continue;

0 commit comments

Comments
 (0)