From 44a90b49d8dcea287b2884d4d2fe4c73049214d7 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 14:23:30 -0700 Subject: [PATCH 01/11] Move objreduce to PyInterpreterState. --- Include/internal/pycore_global_objects.h | 2 ++ Objects/typeobject.c | 4 +++- Tools/c-analyzer/cpython/globals-to-fix.tsv | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Include/internal/pycore_global_objects.h b/Include/internal/pycore_global_objects.h index 3561f686a0de5c..ad456a3641c429 100644 --- a/Include/internal/pycore_global_objects.h +++ b/Include/internal/pycore_global_objects.h @@ -54,6 +54,8 @@ struct _Py_global_objects { struct _Py_interp_cached_objects { int _not_set; + /* object.__reduce__ */ + PyObject *objreduce; }; #define _Py_INTERP_STATIC_OBJECT(interp, NAME) \ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 076f447a6acfc6..4ddee33efdfc7a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5828,7 +5828,8 @@ static PyObject * object___reduce_ex___impl(PyObject *self, int protocol) /*[clinic end generated code: output=2e157766f6b50094 input=f326b43fb8a4c5ff]*/ { - static PyObject *objreduce; +#define objreduce \ + (_Py_INTERP_CACHED_OBJECT(_PyInterpreterState_Get(), objreduce)) PyObject *reduce, *res; if (objreduce == NULL) { @@ -5864,6 +5865,7 @@ object___reduce_ex___impl(PyObject *self, int protocol) } return _common_reduce(self, protocol); +#undef objreduce } static PyObject * diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index ad4e0aebc6d18c..4c3c9d3825d4a8 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -304,9 +304,6 @@ Objects/sliceobject.c - _Py_EllipsisObject - # manually cached PyUnicodeObject Python/ast_unparse.c - _str_replace_inf - -# other -Objects/typeobject.c object___reduce_ex___impl objreduce - - #----------------------- # other From f748f82dee129e96c134988801e294845220d1a5 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 15:12:27 -0700 Subject: [PATCH 02/11] Move the cached values in resolve_slotdups() to PyInterpreterState. --- Include/internal/pycore_global_objects.h | 3 ++ Include/internal/pycore_typeobject.h | 9 +++++ Objects/typeobject.c | 37 +++++++++------------ Tools/c-analyzer/cpython/globals-to-fix.tsv | 4 --- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/Include/internal/pycore_global_objects.h b/Include/internal/pycore_global_objects.h index ad456a3641c429..bf64748daed2c3 100644 --- a/Include/internal/pycore_global_objects.h +++ b/Include/internal/pycore_global_objects.h @@ -10,6 +10,7 @@ extern "C" { #include "pycore_gc.h" // PyGC_Head #include "pycore_global_strings.h" // struct _Py_global_strings +#include "pycore_typeobject.h" // pytype_slotdef // These would be in pycore_long.h if it weren't for an include cycle. @@ -56,6 +57,8 @@ struct _Py_interp_cached_objects { int _not_set; /* object.__reduce__ */ PyObject *objreduce; + PyObject *type_slots_pname; + pytype_slotdef *type_slots_ptrs[MAX_EQUIV]; }; #define _Py_INTERP_STATIC_OBJECT(interp, NAME) \ diff --git a/Include/internal/pycore_typeobject.h b/Include/internal/pycore_typeobject.h index 5e7aca1b9f5ae9..71f3068900da31 100644 --- a/Include/internal/pycore_typeobject.h +++ b/Include/internal/pycore_typeobject.h @@ -18,6 +18,15 @@ extern void _PyTypes_Fini(PyInterpreterState *); /* other API */ +/* Length of array of slotdef pointers used to store slots with the + same __name__. There should be at most MAX_EQUIV-1 slotdef entries with + the same __name__, for any __name__. Since that's a static property, it is + appropriate to declare fixed-size arrays for this. */ +#define MAX_EQUIV 10 + +typedef struct wrapperbase pytype_slotdef; + + // Type attribute lookup cache: speed up attribute and method lookups, // see _PyType_Lookup(). struct type_cache_entry { diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 4ddee33efdfc7a..351e32b26e845d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -8526,8 +8526,6 @@ __ne__ etc. all map to tp_richcompare) and one name may map to multiple slots an all-zero entry. */ -typedef struct wrapperbase slotdef; - #undef TPSLOT #undef FLSLOT #undef AMSLOT @@ -8576,7 +8574,7 @@ typedef struct wrapperbase slotdef; ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \ #NAME "($self, value, /)\n--\n\n" DOC) -static slotdef slotdefs[] = { +static pytype_slotdef slotdefs[] = { TPSLOT(__getattribute__, tp_getattr, NULL, NULL, ""), TPSLOT(__getattr__, tp_getattr, NULL, NULL, ""), TPSLOT(__setattr__, tp_setattr, NULL, NULL, ""), @@ -8801,12 +8799,6 @@ slotptr(PyTypeObject *type, int ioffset) return (void **)ptr; } -/* Length of array of slotdef pointers used to store slots with the - same __name__. There should be at most MAX_EQUIV-1 slotdef entries with - the same __name__, for any __name__. Since that's a static property, it is - appropriate to declare fixed-size arrays for this. */ -#define MAX_EQUIV 10 - /* Return a slot pointer for a given name, but ONLY if the attribute has exactly one slot function. The name must be an interned string. */ static void ** @@ -8815,9 +8807,10 @@ resolve_slotdups(PyTypeObject *type, PyObject *name) /* XXX Maybe this could be optimized more -- but is it worth it? */ /* pname and ptrs act as a little cache */ - static PyObject *pname; - static slotdef *ptrs[MAX_EQUIV]; - slotdef *p, **pp; + PyInterpreterState *interp = _PyInterpreterState_Get(); +#define pname _Py_INTERP_CACHED_OBJECT(interp, type_slots_pname) +#define ptrs _Py_INTERP_CACHED_OBJECT(interp, type_slots_ptrs) + pytype_slotdef *p, **pp; void **res, **ptr; if (pname != name) { @@ -8844,6 +8837,8 @@ resolve_slotdups(PyTypeObject *type, PyObject *name) res = ptr; } return res; +#undef pname +#undef ptrs } @@ -8901,8 +8896,8 @@ resolve_slotdups(PyTypeObject *type, PyObject *name) * When done, return a pointer to the next slotdef with a different offset, * because that's convenient for fixup_slot_dispatchers(). This function never * sets an exception: if an internal error happens (unlikely), it's ignored. */ -static slotdef * -update_one_slot(PyTypeObject *type, slotdef *p) +static pytype_slotdef * +update_one_slot(PyTypeObject *type, pytype_slotdef *p) { PyObject *descr; PyWrapperDescrObject *d; @@ -9017,7 +9012,7 @@ update_one_slot(PyTypeObject *type, slotdef *p) static int update_slots_callback(PyTypeObject *type, void *data) { - slotdef **pp = (slotdef **)data; + pytype_slotdef **pp = (pytype_slotdef **)data; for (; *pp; pp++) { update_one_slot(type, *pp); } @@ -9028,9 +9023,9 @@ update_slots_callback(PyTypeObject *type, void *data) static int update_slot(PyTypeObject *type, PyObject *name) { - slotdef *ptrs[MAX_EQUIV]; - slotdef *p; - slotdef **pp; + pytype_slotdef *ptrs[MAX_EQUIV]; + pytype_slotdef *p; + pytype_slotdef **pp; int offset; assert(PyUnicode_CheckExact(name)); @@ -9067,7 +9062,7 @@ static void fixup_slot_dispatchers(PyTypeObject *type) { assert(!PyErr_Occurred()); - for (slotdef *p = slotdefs; p->name; ) { + for (pytype_slotdef *p = slotdefs; p->name; ) { p = update_one_slot(type, p); } } @@ -9075,7 +9070,7 @@ fixup_slot_dispatchers(PyTypeObject *type) static void update_all_slots(PyTypeObject* type) { - slotdef *p; + pytype_slotdef *p; /* Clear the VALID_VERSION flag of 'type' and all its subclasses. */ PyType_Modified(type); @@ -9246,7 +9241,7 @@ static int add_operators(PyTypeObject *type) { PyObject *dict = type->tp_dict; - slotdef *p; + pytype_slotdef *p; PyObject *descr; void **ptr; diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 4c3c9d3825d4a8..089df1e6b2be81 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -312,9 +312,6 @@ Python/context.c - _token_missing - Python/hamt.c - _empty_bitmap_node - Python/hamt.c - _empty_hamt - -# state -Objects/typeobject.c resolve_slotdups pname - - ################################## # global non-objects to fix in core code @@ -436,7 +433,6 @@ Python/perf_trampoline.c - extra_code_index - Python/perf_trampoline.c - code_arena - Python/perf_trampoline.c - trampoline_api - Objects/typeobject.c - next_version_tag - -Objects/typeobject.c resolve_slotdups ptrs - Parser/pegen.c - memo_statistics - Python/bootstrap_hash.c - urandom_cache - Python/ceval_gil.c make_pending_calls busy - From 8350dd1776e6e27389dca8c308c3c214c865a0a1 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 15:27:12 -0700 Subject: [PATCH 03/11] Move next_version_tag to _PyRuntimeState. --- Include/internal/pycore_runtime.h | 7 +++++++ Include/internal/pycore_runtime_init.h | 3 +++ Objects/typeobject.c | 4 +--- Tools/c-analyzer/cpython/globals-to-fix.tsv | 1 - 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index a54906841edc86..092adca4a47050 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -136,6 +136,13 @@ typedef struct pyruntimestate { struct _Py_unicode_runtime_ids unicode_ids; + struct { + /* Used to set PyTypeObject.tp_version_tag */ + // bpo-42745: next_version_tag remains shared by all interpreters + // because of static types. + unsigned int next_version_tag; + } types; + /* All the objects that are shared by the runtime's interpreters. */ struct _Py_global_objects global_objects; diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h index 38c1747b016c50..9a2aad24b56970 100644 --- a/Include/internal/pycore_runtime_init.h +++ b/Include/internal/pycore_runtime_init.h @@ -36,6 +36,9 @@ extern "C" { until _PyInterpreterState_Enable() is called. */ \ .next_id = -1, \ }, \ + .types = { \ + .next_version_tag = 1, \ + }, \ .global_objects = { \ .singletons = { \ .small_ints = _Py_small_ints_INIT, \ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 351e32b26e845d..675d6d874de6bd 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -43,9 +43,7 @@ class object "PyObject *" "&PyBaseObject_Type" PyUnicode_IS_READY(name) && \ (PyUnicode_GET_LENGTH(name) <= MCACHE_MAX_ATTR_SIZE) -// bpo-42745: next_version_tag remains shared by all interpreters because of static types -// Used to set PyTypeObject.tp_version_tag -static unsigned int next_version_tag = 1; +#define next_version_tag (_PyRuntime.types.next_version_tag) typedef struct PySlot_Offset { short subslot_offset; diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 089df1e6b2be81..283cce62341bc0 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -432,7 +432,6 @@ Python/perf_trampoline.c - perf_status - Python/perf_trampoline.c - extra_code_index - Python/perf_trampoline.c - code_arena - Python/perf_trampoline.c - trampoline_api - -Objects/typeobject.c - next_version_tag - Parser/pegen.c - memo_statistics - Python/bootstrap_hash.c - urandom_cache - Python/ceval_gil.c make_pending_calls busy - From 526d2daa3373dae6fa294371b459752cb3f8513e Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 15:38:39 -0700 Subject: [PATCH 04/11] Move _str_replace_inf to _PyRuntimeState. --- Include/internal/pycore_global_objects.h | 7 +++++++ Include/internal/pycore_runtime.h | 1 + Parser/asdl_c.py | 4 ++++ Python/Python-ast.c | 4 ++++ Python/ast_unparse.c | 2 +- Tools/c-analyzer/cpython/globals-to-fix.tsv | 6 ------ 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Include/internal/pycore_global_objects.h b/Include/internal/pycore_global_objects.h index bf64748daed2c3..5ad1f7d217f7db 100644 --- a/Include/internal/pycore_global_objects.h +++ b/Include/internal/pycore_global_objects.h @@ -21,6 +21,13 @@ extern "C" { // Only immutable objects should be considered runtime-global. // All others must be per-interpreter. +#define _Py_CACHED_OBJECT(NAME) \ + _PyRuntime.cached_objects.NAME + +struct _Py_cached_objects { + PyObject *str_replace_inf; +}; + #define _Py_GLOBAL_OBJECT(NAME) \ _PyRuntime.global_objects.NAME #define _Py_SINGLETON(NAME) \ diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index 092adca4a47050..6bcb35b35610f0 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -144,6 +144,7 @@ typedef struct pyruntimestate { } types; /* All the objects that are shared by the runtime's interpreters. */ + struct _Py_cached_objects cached_objects; struct _Py_global_objects global_objects; /* The following fields are here to avoid allocation during init. diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index 972d89649af5fc..8bdd253fee5f8f 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -1483,6 +1483,10 @@ def generate_ast_fini(module_state, f): for s in module_state: f.write(" Py_CLEAR(state->" + s + ');\n') f.write(textwrap.dedent(""" + if (_PyInterpreterState_Get() == _PyInterpreterState_Main()) { + Py_CLEAR(_Py_CACHED_OBJECT(str_replace_inf)); + } + #if !defined(NDEBUG) state->initialized = -1; #else diff --git a/Python/Python-ast.c b/Python/Python-ast.c index b57aca377b9914..31c38e8a805767 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -263,6 +263,10 @@ void _PyAST_Fini(PyInterpreterState *interp) Py_CLEAR(state->vararg); Py_CLEAR(state->withitem_type); + if (_PyInterpreterState_Get() == _PyInterpreterState_Main()) { + Py_CLEAR(_Py_CACHED_OBJECT(str_replace_inf)); + } + #if !defined(NDEBUG) state->initialized = -1; #else diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c index 6565b6b33ebd52..79b2e2f15ba243 100644 --- a/Python/ast_unparse.c +++ b/Python/ast_unparse.c @@ -13,7 +13,7 @@ _Py_DECLARE_STR(open_br, "{"); _Py_DECLARE_STR(dbl_open_br, "{{"); _Py_DECLARE_STR(close_br, "}"); _Py_DECLARE_STR(dbl_close_br, "}}"); -static PyObject *_str_replace_inf; +#define _str_replace_inf _Py_CACHED_OBJECT(str_replace_inf) /* Forward declarations for recursion via helper functions. */ static PyObject * diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 283cce62341bc0..136b703c717110 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -298,12 +298,6 @@ Objects/setobject.c - _dummy_struct - Objects/setobject.c - _PySet_Dummy - Objects/sliceobject.c - _Py_EllipsisObject - -#----------------------- -# cached - initialized once - -# manually cached PyUnicodeObject -Python/ast_unparse.c - _str_replace_inf - - #----------------------- # other From c68d016cd8335b9de4eea748ec9aad02b3f9e7b4 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 16:07:05 -0700 Subject: [PATCH 05/11] Drop some globals from the whitelist. --- Tools/c-analyzer/cpython/globals-to-fix.tsv | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 136b703c717110..2e404b378ff1fb 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -509,9 +509,6 @@ Modules/_io/_iomodule.c - _PyIO_empty_bytes - Modules/_testcapi/heaptype.c - _testcapimodule - Modules/_testcapi/unicode.c - _testcapimodule - Modules/_tracemalloc.c - tracemalloc_empty_traceback - -Modules/signalmodule.c - DefaultHandler - -Modules/signalmodule.c - IgnoreHandler - -Modules/signalmodule.c - IntHandler - # state Modules/faulthandler.c - fatal_error - From d5d6c2d6bd8014940546cb9eca76862228ad8d15 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 16:12:54 -0700 Subject: [PATCH 06/11] Move a whitelist entry to the right section. --- Tools/c-analyzer/cpython/globals-to-fix.tsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 2e404b378ff1fb..0dbbda34f23026 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -508,7 +508,6 @@ Modules/_functoolsmodule.c - kwd_mark - Modules/_io/_iomodule.c - _PyIO_empty_bytes - Modules/_testcapi/heaptype.c - _testcapimodule - Modules/_testcapi/unicode.c - _testcapimodule - -Modules/_tracemalloc.c - tracemalloc_empty_traceback - # state Modules/faulthandler.c - fatal_error - @@ -537,6 +536,7 @@ Modules/timemodule.c _PyTime_GetProcessTimeWithInfo ticks_per_second - Modules/_tracemalloc.c - allocators - Modules/_tracemalloc.c - tables_lock - +Modules/_tracemalloc.c - tracemalloc_empty_traceback - Modules/_tracemalloc.c - tracemalloc_traced_memory - Modules/_tracemalloc.c - tracemalloc_peak_traced_memory - Modules/_tracemalloc.c - tracemalloc_filenames - From 9f1514829aa0685e8761ef98ad13d65c49823f2e Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 16:15:26 -0700 Subject: [PATCH 07/11] Move some test-related globals to the ignored list. --- Tools/c-analyzer/cpython/globals-to-fix.tsv | 2 -- Tools/c-analyzer/cpython/ignored.tsv | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 0dbbda34f23026..9e2f81d3ec9614 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -506,8 +506,6 @@ Modules/_io/winconsoleio.c - _PyWindowsConsoleIO_Type - # initialized once Modules/_functoolsmodule.c - kwd_mark - Modules/_io/_iomodule.c - _PyIO_empty_bytes - -Modules/_testcapi/heaptype.c - _testcapimodule - -Modules/_testcapi/unicode.c - _testcapimodule - # state Modules/faulthandler.c - fatal_error - diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv index e657fa77be0145..30b2bc75183f70 100644 --- a/Tools/c-analyzer/cpython/ignored.tsv +++ b/Tools/c-analyzer/cpython/ignored.tsv @@ -181,6 +181,8 @@ Modules/_testbuffer.c ndarray_memoryview_from_buffer strides - Modules/_testbuffer.c ndarray_memoryview_from_buffer suboffsets - Modules/_testbuffer.c ndarray_push kwlist - Modules/_testbuffer.c staticarray_init kwlist - +Modules/_testcapi/heaptype.c - _testcapimodule - +Modules/_testcapi/unicode.c - _testcapimodule - Modules/_testcapimodule.c - ContainerNoGC_members - Modules/_testcapimodule.c - ContainerNoGC_type - Modules/_testcapimodule.c - FmData - From 84c701d0afdc8e0ae6450a1773ba22fb6ccf905e Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 16:18:43 -0700 Subject: [PATCH 08/11] Drop a missing global from the whitelist. --- Tools/c-analyzer/cpython/globals-to-fix.tsv | 1 - 1 file changed, 1 deletion(-) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 9e2f81d3ec9614..8ca6829a964302 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -505,7 +505,6 @@ Modules/_io/winconsoleio.c - _PyWindowsConsoleIO_Type - # initialized once Modules/_functoolsmodule.c - kwd_mark - -Modules/_io/_iomodule.c - _PyIO_empty_bytes - # state Modules/faulthandler.c - fatal_error - From b5a1f43ee267f5ef552550cb84e661f4156e536e Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 16:20:24 -0700 Subject: [PATCH 09/11] Drop another. --- Tools/c-analyzer/cpython/globals-to-fix.tsv | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 8ca6829a964302..27663274e8b058 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -503,9 +503,6 @@ Modules/itertoolsmodule.c - ziplongest_type - # XXX should be const? Modules/_io/winconsoleio.c - _PyWindowsConsoleIO_Type - -# initialized once -Modules/_functoolsmodule.c - kwd_mark - - # state Modules/faulthandler.c - fatal_error - Modules/faulthandler.c - thread - From 41744795cf75c8281032e532a805edc68180a071 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 16:22:46 -0700 Subject: [PATCH 10/11] Move a global from the whitelist to the ingored list. --- Tools/c-analyzer/cpython/globals-to-fix.tsv | 4 ---- Tools/c-analyzer/cpython/ignored.tsv | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index 27663274e8b058..caf3ea266adb7a 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -499,10 +499,6 @@ Modules/itertoolsmodule.c - ziplongest_type - #----------------------- # other -# statically initializd pointer to static type -# XXX should be const? -Modules/_io/winconsoleio.c - _PyWindowsConsoleIO_Type - - # state Modules/faulthandler.c - fatal_error - Modules/faulthandler.c - thread - diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv index 30b2bc75183f70..414e68df60dac9 100644 --- a/Tools/c-analyzer/cpython/ignored.tsv +++ b/Tools/c-analyzer/cpython/ignored.tsv @@ -381,6 +381,7 @@ Modules/_decimal/_decimal.c - ssize_constants - Modules/_elementtree.c - ExpatMemoryHandler - Modules/_io/_iomodule.c - static_types - Modules/_io/textio.c - encodefuncs - +Modules/_io/winconsoleio.c - _PyWindowsConsoleIO_Type - Modules/_localemodule.c - langinfo_constants - Modules/_pickle.c - READ_WHOLE_LINE - Modules/_sqlite/module.c - error_codes - From 1275901f18c45a34e35ced1a9887c436233e7f10 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Fri, 11 Nov 2022 16:24:19 -0700 Subject: [PATCH 11/11] Move a whitelist entry to the right section. --- Tools/c-analyzer/cpython/globals-to-fix.tsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index caf3ea266adb7a..aaae1e851480eb 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -505,7 +505,6 @@ Modules/faulthandler.c - thread - Modules/faulthandler.c - user_signals - Modules/faulthandler.c - stack - Modules/faulthandler.c - old_stack - -Modules/signalmodule.c - Handlers - ################################## @@ -540,6 +539,7 @@ Modules/posixmodule.c - environ - Modules/signalmodule.c - is_tripped - Modules/signalmodule.c - signal_global_state - Modules/signalmodule.c - wakeup - +Modules/signalmodule.c - Handlers - ##################################