Skip to content
Prev Previous commit
Lock around store_interned().
  • Loading branch information
ericsnowcurrently committed Mar 20, 2023
commit b634920ab3e11ce464da664f4268e2366d2bdce0
2 changes: 2 additions & 0 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -14664,7 +14664,9 @@ PyUnicode_InternInPlace(PyObject **p)
return;
}

PyThread_acquire_lock(_PyRuntime.unicode_state.interned.lock, WAIT_LOCK);
PyObject *t = store_interned(s);
PyThread_release_lock(_PyRuntime.unicode_state.interned.lock);
if (t != s) {
if (t != NULL) {
Py_SETREF(*p, Py_NewRef(t));
Expand Down