gh-81057: Move Globals in Core Code to _PyRuntimeState (gh-99496)

This is the first of several changes to consolidate non-object globals in core code.

https://github.com/python/cpython/issues/81057
This commit is contained in:
Eric Snow 2022-11-15 09:45:11 -07:00 committed by GitHub
parent 73943cbc4c
commit 3c57971a2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 235 additions and 167 deletions

View file

@ -1846,9 +1846,6 @@ vgetargskeywords(PyObject *args, PyObject *kwargs, const char *format,
}
/* List of static parsers. */
static struct _PyArg_Parser *static_arg_parsers = NULL;
static int
scan_keywords(const char * const *keywords, int *ptotal, int *pposonly)
{
@ -2024,8 +2021,8 @@ _parser_init(struct _PyArg_Parser *parser)
parser->initialized = owned ? 1 : -1;
assert(parser->next == NULL);
parser->next = static_arg_parsers;
static_arg_parsers = parser;
parser->next = _PyRuntime.getargs.static_parsers;
_PyRuntime.getargs.static_parsers = parser;
return 1;
}
@ -2930,14 +2927,14 @@ _PyArg_NoKwnames(const char *funcname, PyObject *kwnames)
void
_PyArg_Fini(void)
{
struct _PyArg_Parser *tmp, *s = static_arg_parsers;
struct _PyArg_Parser *tmp, *s = _PyRuntime.getargs.static_parsers;
while (s) {
tmp = s->next;
s->next = NULL;
parser_clear(s);
s = tmp;
}
static_arg_parsers = NULL;
_PyRuntime.getargs.static_parsers = NULL;
}
#ifdef __cplusplus