mirror of https://github.com/python/cpython
bpo-40521: Fix update_slot() when INTERN_NAME_STRINGS is not defined (#20246)
Fix type update_slot() function when the macro INTERN_NAME_STRINGS is not defined: use _PyUnicode_EQ() in this case.
This commit is contained in:
parent
aca4670ad6
commit
0509c4547f
|
@ -7661,8 +7661,17 @@ update_slot(PyTypeObject *type, PyObject *name)
|
||||||
assert(slotdefs_initialized);
|
assert(slotdefs_initialized);
|
||||||
pp = ptrs;
|
pp = ptrs;
|
||||||
for (p = slotdefs; p->name; p++) {
|
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;
|
*pp++ = p;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (p->name_strobj == name || _PyUnicode_EQ(p->name_strobj, name)) {
|
||||||
|
*pp++ = p;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
*pp = NULL;
|
*pp = NULL;
|
||||||
for (pp = ptrs; *pp; pp++) {
|
for (pp = ptrs; *pp; pp++) {
|
||||||
|
|
Loading…
Reference in New Issue