From 01b1cc12e7c6a3d6a3d27ba7c731687d57aae92a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 20 Nov 2019 02:27:56 +0100 Subject: bpo-36710: Add PyInterpreterState.runtime field (GH-17270) Add PyInterpreterState.runtime field: reference to the _PyRuntime global variable. This field exists to not have to pass runtime in addition to tstate to a function. Get runtime from tstate: tstate->interp->runtime. Remove "_PyRuntimeState *runtime" parameter from functions already taking a "PyThreadState *tstate" parameter. _PyGC_Init() first parameter becomes "PyThreadState *tstate". --- Modules/gcmodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 78f6631866..05ca026189 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -155,9 +155,9 @@ _PyGC_InitializeRuntime(struct _gc_runtime_state *state) PyStatus -_PyGC_Init(_PyRuntimeState *runtime) +_PyGC_Init(PyThreadState *tstate) { - struct _gc_runtime_state *state = &runtime->gc; + struct _gc_runtime_state *state = &tstate->interp->runtime->gc; if (state->garbage == NULL) { state->garbage = PyList_New(0); if (state->garbage == NULL) { -- cgit v1.2.1