bpo-40521: Make MemoryError free list per interpreter (GH-21086)

Each interpreter now has its own MemoryError free list: it is not
longer shared by all interpreters.

Add _Py_exc_state structure and PyInterpreterState.exc_state member.
Move also errnomap into _Py_exc_state.
This commit is contained in:
Victor Stinner 2020-06-23 22:55:46 +02:00 committed by GitHub
parent 2c6e4e91c5
commit 281cce1106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 39 deletions

View file

@ -602,7 +602,7 @@ pycore_init_types(PyThreadState *tstate)
}
}
status = _PyExc_Init();
status = _PyExc_Init(tstate);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
@ -1249,6 +1249,7 @@ flush_std_files(void)
static void
finalize_interp_types(PyThreadState *tstate, int is_main_interp)
{
_PyExc_Fini(tstate);
_PyFrame_Fini(tstate);
_PyAsyncGen_Fini(tstate);
_PyContext_Fini(tstate);
@ -1289,10 +1290,6 @@ finalize_interp_clear(PyThreadState *tstate)
_PyWarnings_Fini(tstate->interp);
if (is_main_interp) {
_PyExc_Fini();
}
finalize_interp_types(tstate, is_main_interp);
}