Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a260def

Browse files
committedDec 10, 2023
[3.12] orbital: Added custom entry in PyInterpreterState
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.
1 parent ca11aec commit a260def

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎Include/internal/pycore_interp.h

+5
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ struct _is {
103103
size_t stacksize;
104104
} threads;
105105

106+
107+
// ORBITAL MODIFICATIONS (hey guys, don't mind me)
108+
const void* orb_passthough;
109+
110+
106111
/* Reference to the _PyRuntime global variable. This field exists
107112
to not have to pass runtime in addition to tstate to a function.
108113
Get runtime from tstate: tstate->interp->runtime. */

0 commit comments

Comments
 (0)
Please sign in to comment.