Skip to content

Commit

Permalink
Use mortal strings in type_setattro
Browse files Browse the repository at this point in the history
bpo-40521 (pythonGH-84701) is now long solved.
  • Loading branch information
encukou committed Jun 14, 2024
1 parent a288389 commit 6036cb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5644,9 +5644,9 @@ type_setattro(PyObject *self, PyObject *name, PyObject *value)
if (name == NULL)
return -1;
}
/* bpo-40521: Interned strings are shared by all subinterpreters */
if (!PyUnicode_CHECK_INTERNED(name)) {
PyUnicode_InternInPlace(&name);
PyInterpreterState *interp = _PyInterpreterState_GET();
_PyUnicode_InternMortal(interp, &name);
if (!PyUnicode_CHECK_INTERNED(name)) {
PyErr_SetString(PyExc_MemoryError,
"Out of memory interning an attribute name");
Expand Down

0 comments on commit 6036cb1

Please sign in to comment.