From 76d5abc8684bac4f2fc7cccfe2cd940923357351 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Tue, 5 Sep 2017 18:26:16 -0700 Subject: bpo-30860: Consolidate stateful runtime globals. (#2594) * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py). --- Parser/pgenmain.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Parser') diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c index e386248c2f..fd927c0a96 100644 --- a/Parser/pgenmain.c +++ b/Parser/pgenmain.c @@ -21,10 +21,12 @@ #include "node.h" #include "parsetok.h" #include "pgen.h" +#include "internal/_mem.h" int Py_DebugFlag; int Py_VerboseFlag; int Py_IgnoreEnvironmentFlag; +struct pyruntimestate _PyRuntime = {}; /* Forward */ grammar *getgrammar(const char *filename); @@ -61,6 +63,8 @@ main(int argc, char **argv) filename = argv[1]; graminit_h = argv[2]; graminit_c = argv[3]; + _PyObject_Initialize(&_PyRuntime.obj); + _PyMem_Initialize(&_PyRuntime.mem); g = getgrammar(filename); fp = fopen(graminit_c, "w"); if (fp == NULL) { -- cgit v1.2.1