diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h index 976e16a3742bda..96e7008d4c0e02 100644 --- a/Include/internal/pycore_interp.h +++ b/Include/internal/pycore_interp.h @@ -26,6 +26,7 @@ extern "C" { #include "pycore_unicodeobject.h" // struct _Py_unicode_state #include "pycore_warnings.h" // struct _warnings_runtime_state + struct _pending_calls { PyThread_type_lock lock; /* Request for running pending calls. */ diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index d50455b8036999..8b2b9d7a85b231 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -19,7 +19,8 @@ extern "C" { #include "pycore_unicodeobject.h" // struct _Py_unicode_runtime_ids struct _getargs_runtime_state { - PyThread_type_lock mutex; + PyThread_type_lock mutex; + struct _PyArg_Parser *static_parsers; }; /* ceval state */ diff --git a/Python/getargs.c b/Python/getargs.c index 703462242a0585..748209d7d713f8 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -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 diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 77fc09e88830dd..b4ac9120d98bb0 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -327,9 +327,6 @@ Objects/unicodeobject.c - ucnhash_capi - # local buffer Python/suggestions.c levenshtein_distance buffer - -# linked list -Python/getargs.c - static_arg_parsers - - # other Objects/dictobject.c - _pydict_global_version - Objects/dictobject.c - next_dict_keys_version -