Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
Next Next commit
add multiple slotdefs check
  • Loading branch information
kumaraditya303 committed Mar 29, 2026
commit 4bbf3401aee6d7afe7992489f164b3a922f7f8a8
22 changes: 19 additions & 3 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -11768,11 +11768,27 @@ update_one_slot(PyTypeObject *type, pytype_slotdef *p, pytype_slotdef **next_p,
((PyWrapperDescrObject *)descr)->d_base->name_strobj == p->name_strobj) {
void **tptr;
size_t index = (p - slotdefs);
if (slotdefs_name_counts[index] == 1) {
tptr = slotptr(type, p->offset);
if (slotdefs_name_counts[index] > 1) {
/* If multiple slotdefs have the same name,
* if we need to check that only one of them has the slot filled
* and return that, else return NULL.
*/
tptr = NULL;
for (pytype_slotdef *q = slotdefs; q->name_strobj; q++) {
if (q->name_strobj != p->name_strobj)
continue;
void **qptr = slotptr(type, q->offset);
if (qptr == NULL || *qptr == NULL)
continue;
if (tptr != NULL) {
tptr = NULL;
break;
}
tptr = qptr;
}
}
else {
tptr = NULL;
tptr = slotptr(type, p->offset);
}

if (tptr == NULL || tptr == ptr)
Expand Down
Loading