diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 3498f0d484..d11ac5a419 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -7466,24 +7466,17 @@ slotptr(PyTypeObject *type, int ioffset) static void ** resolve_slotdups(PyTypeObject *type, PyObject *name) { - /* XXX Maybe this could be optimized more -- but is it worth it? */ - - /* pname and ptrs act as a little cache */ - static PyObject *pname; - static slotdef *ptrs[MAX_EQUIV]; + slotdef *ptrs[MAX_EQUIV]; slotdef *p, **pp; void **res, **ptr; - if (pname != name) { - /* Collect all slotdefs that match name into ptrs. */ - pname = name; - pp = ptrs; - for (p = slotdefs; p->name_strobj; p++) { - if (p->name_strobj == name) - *pp++ = p; - } - *pp = NULL; + /* Collect all slotdefs that match name into ptrs. */ + pp = ptrs; + for (p = slotdefs; p->name_strobj; p++) { + if (p->name_strobj == name) + *pp++ = p; } + *pp = NULL; /* Look in all slots of the type matching the name. If exactly one of these has a filled-in slot, return a pointer to that slot.