bpo-46006: Fix _PyUnicode_EqualToASCIIId() for interned strings by vstinner · Pull Request #30123 · python/cpython · GitHub
Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -8459,7 +8459,10 @@ update_slot(PyTypeObject *type, PyObject *name)
for (p = slotdefs; p->name; p++) {
assert(PyUnicode_CheckExact(p->name_strobj));
assert(PyUnicode_CheckExact(name));
if (p->name_strobj == name) {
// bpo-46006: subinterpreters require to compare strings contents, even
// if both strings are interned. _PyUnicode_EQ() is required to keep
// support for built-in static types in subinterpreters.
if (p->name_strobj == name || _PyUnicode_EQ(p->name_strobj, name)) {
*pp++ = p;
}
}
Expand Down
15 changes: 11 additions & 4 deletions Objects/unicodeobject.c