Commit 787e9dc
committed
[3.12] orbital: Added custom entry in
Hijacked the interpreter state to get my boys on the inside. Currently,
there doesn't seem to be an officially supported way to get a piece of
pre-initialized per-interpreter memory over to an embedded module (more
specifically, the embedded module's functions).
For example:
[init'd mem python#1] ----> [subinterp python#1] ----> {module fn call}
[init'd mem python#2] ----> [subinterp python#2] ----> {module fn call}
{module fn call} has a single implementation with access to its module
state via `PyModule_GetState`. The initialization of a subinterpreter
populates a custom entry for the pre-initialized memory in its interpreter
state. On initialization of the embedded module (`Py_mod_exec`), the
module state is populated with the custom entry
(`PyThreadState_Get()->interp`). The module function now has access to
the pre-initialized memory via its module state.PyInterpreterState
1 parent ca11aec commit 787e9dc
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
106 | 111 | | |
107 | 112 | | |
108 | 113 | | |
| |||
0 commit comments