classification
Title: [subinterpreters][meta] Move fields from _PyRuntimeState to PyInterpreterState.
Type: Stage: resolved
Components: Subinterpreters Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder: [subinterpreters] Meta issue: per-interpreter GIL
View: 40512
Assigned To: eric.snow Nosy List: eric.snow, maciej.szulik, phsilva, vstinner
Priority: normal Keywords:

Created on 2019-05-10 19:11 by eric.snow, last changed 2020-05-15 01:31 by vstinner. This issue is now closed.

Messages (4)
msg342120 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-05-10 19:11
We have quite a bit of global state the runtime that effectively breaks the isolation between interpreters.  Some of it exists as "global" C variables (see #36876) and the rest as fields on _PyRuntimeState.  The offending state should be moved to PyInterpreterState.

See Include/internal/pycore_pystate.h for the _PyRuntimeState and PyInterpreterState structs.
msg342121 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-05-10 19:16
FYI, I've already started some of this work:

* #36737 warnings
* #36854 gc
* #33608 pending calls
* #10915 & #15751 gilstate

Other bits I'm planning on:
* the rest of the global "ceval" state
* the memory allocators
* the GIL

Note that, to make the GIL per-interpreter, we can't have any remaining runtime state shared by interpreters (unless it is protected by its own locks).
msg342126 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-05-10 20:15
In conjunction with #36876, there are a bunch of currently ignored globals (in Tools/c-globals/ignored-globals.txt) that should actually be moved to per-interpreter runtime state.  This mostly applies to any globals that point to one or more objects, since objects must not be shared by interpreters.
msg368907 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-15 01:31
I mark this issue as a duplicate of bpo-40512.
History
Date User Action Args
2020-05-15 01:31:54vstinnersetstatus: open -> closed
superseder: [subinterpreters] Meta issue: per-interpreter GIL
messages: + msg368907

resolution: duplicate
stage: resolved
2020-05-15 00:46:20vstinnersetcomponents: + Subinterpreters, - Interpreter Core
title: [meta] Move fields from _PyRuntimeState to PyInterpreterState. -> [subinterpreters][meta] Move fields from _PyRuntimeState to PyInterpreterState.
2020-02-07 15:21:21maciej.szuliksetnosy: + maciej.szulik
2019-08-22 02:49:20phsilvasetnosy: + phsilva
2019-05-10 20:15:42eric.snowsetmessages: + msg342126
2019-05-10 19:16:48eric.snowsetmessages: + msg342121
2019-05-10 19:11:57eric.snowcreate