Avoids potential deadlocks with C++ static local initialization in
extensions that call PyUnicode_InternFromString during one-time
initialization.
--- /dev/null
+Fix a potential deadlock in :c:func:`PyUnicode_InternFromString` and other
+interning functions in the :term:`free-threaded build` when called from C++
+static local initializers.
}
#endif
- FT_MUTEX_LOCK(INTERN_MUTEX);
+ FT_MUTEX_LOCK_FLAGS(INTERN_MUTEX, _Py_LOCK_DONT_DETACH);
PyObject *t;
{
int res = PyDict_SetDefaultRef(interned, s, s, &t);