Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Make sure the one-off tstate is bound before using it.
  • Loading branch information
ericsnowcurrently committed Mar 22, 2023
commit 4f25244cd227b7b64a18f26a688f0ab0745c2d5d
7 changes: 7 additions & 0 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -14601,8 +14601,15 @@ store_interned(PyObject *obj)
PyThreadState *oldts = NULL;
if (!_Py_IsMainInterpreter(_PyInterpreterState_GET())) {
PyThreadState *main_tstate = get_interned_tstate();
int bound = _PyThreadState_IsBound(main_tstate);
if (!bound) {
_PyThreadState_Bind(main_tstate);
}
oldts = PyThreadState_Swap(main_tstate);
assert(oldts != NULL);
if (!bound) {
_PyThreadState_Unbind(main_tstate);
}
}

PyObject *t = PyDict_SetDefault(interned, obj, obj);
Expand Down