mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-30860: Consolidate stateful runtime globals. (#3397)
* 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).
This commit is contained in:
parent
bab21faded
commit
2ebc5ce42a
72 changed files with 2746 additions and 1312 deletions
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include "Python.h"
|
||||
#include "internal/pystate.h"
|
||||
#ifdef MS_WINDOWS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include "windows.h"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
#define PGEN
|
||||
|
||||
#include "Python.h"
|
||||
#include "internal/mem.h"
|
||||
#include "internal/pystate.h"
|
||||
#include "pgenheaders.h"
|
||||
#include "grammar.h"
|
||||
#include "node.h"
|
||||
|
|
@ -25,6 +27,7 @@
|
|||
int Py_DebugFlag;
|
||||
int Py_VerboseFlag;
|
||||
int Py_IgnoreEnvironmentFlag;
|
||||
_PyRuntimeState _PyRuntime = {0, 0};
|
||||
|
||||
/* Forward */
|
||||
grammar *getgrammar(const char *filename);
|
||||
|
|
@ -59,6 +62,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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue