Skip to content
Merged
Changes from all commits
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
bpo-40521: Fix update_slot() whne INTERN_NAME_STRINGS is not defined
Fix type update_slot() function when the macro INTERN_NAME_STRINGS is
not defined: use _PyUnicode_EQ() in this case.
  • Loading branch information
vstinner committed May 19, 2020
commit b1a7ccaa64f41a19db543d29a46339ada4f74aeb
11 changes: 10 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -7661,8 +7661,17 @@ update_slot(PyTypeObject *type, PyObject *name)
assert(slotdefs_initialized);
pp = ptrs;
for (p = slotdefs; p->name; p++) {
if (p->name_strobj == name)
assert(PyUnicode_CheckExact(p->name_strobj));
assert(PyUnicode_CheckExact(name));
#ifdef INTERN_NAME_STRINGS
if (p->name_strobj == name) {
*pp++ = p;
}
#else
if (p->name_strobj == name || _PyUnicode_EQ(p->name_strobj, name)) {
*pp++ = p;
}
#endif
}
*pp = NULL;
for (pp = ptrs; *pp; pp++) {
Expand Down