summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-11-10 16:03:57 (GMT)
committerGitHub <noreply@github.com>2022-11-10 16:03:57 (GMT)
commit73679b13ca38a25da878d13b0674961b8ea53eb5 (patch)
treea24e07ffaa6e59544fb52726e425fbba517a5de7
parent6dedf42527fddbed8ef61ef8d3f025bf3a373359 (diff)
downloadcpython-73679b13ca38a25da878d13b0674961b8ea53eb5.zip
cpython-73679b13ca38a25da878d13b0674961b8ea53eb5.tar.gz
cpython-73679b13ca38a25da878d13b0674961b8ea53eb5.tar.bz2
gh-90110: Update the C-analyzer Tool (gh-99307)
-rw-r--r--Modules/zlibmodule.c2
-rw-r--r--Tools/c-analyzer/cpython/_parser.py6
-rw-r--r--Tools/c-analyzer/cpython/globals-to-fix.tsv91
-rw-r--r--Tools/c-analyzer/cpython/ignored.tsv5
4 files changed, 14 insertions, 90 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 2a490ed..30c2515 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -1718,7 +1718,7 @@ ZlibDecompressor__new__(PyTypeObject *cls,
PyObject *kwargs)
{
static char *keywords[] = {"wbits", "zdict", NULL};
- static char *format = "|iO:_ZlibDecompressor";
+ static const char * const format = "|iO:_ZlibDecompressor";
int wbits = MAX_WBITS;
PyObject *zdict = NULL;
zlibstate *state = PyType_GetModuleState(cls);
diff --git a/Tools/c-analyzer/cpython/_parser.py b/Tools/c-analyzer/cpython/_parser.py
index 78241f0..769e274 100644
--- a/Tools/c-analyzer/cpython/_parser.py
+++ b/Tools/c-analyzer/cpython/_parser.py
@@ -82,6 +82,10 @@ Objects/unicodetype_db.h
# generated
Python/deepfreeze/*.c
Python/frozen_modules/*.h
+Python/generated_cases.c.h
+
+# not actually source
+Python/bytecodes.c
# @end=conf@
''')
@@ -285,6 +289,7 @@ Objects/stringlib/codecs.h STRINGLIB_IS_UNICODE 1
SAME = {
_abs('Include/*.h'): [_abs('Include/cpython/')],
+ _abs('Python/ceval.c'): ['Python/generated_cases.c.h'],
}
MAX_SIZES = {
@@ -311,6 +316,7 @@ MAX_SIZES = {
_abs('Python/frozen_modules/*.h'): (20_000, 500),
_abs('Python/opcode_targets.h'): (10_000, 500),
_abs('Python/stdlib_module_names.h'): (5_000, 500),
+ _abs('Python/importlib.h'): (200_000, 5000),
# These large files are currently ignored (see above).
_abs('Modules/_ssl_data.h'): (80_000, 10_000),
diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv
index 56e499d..4cd29a8 100644
--- a/Tools/c-analyzer/cpython/globals-to-fix.tsv
+++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv
@@ -304,20 +304,14 @@ Objects/sliceobject.c - _Py_EllipsisObject -
# manually cached PyUnicodeObject
Python/ast_unparse.c - _str_replace_inf -
-# holds statically-initialized strings
-Objects/typeobject.c - slotdefs -
-
# other
Objects/typeobject.c object___reduce_ex___impl objreduce -
-Objects/unicodeobject.c - _string_module -
-Objects/unicodeobject.c - interned -
#-----------------------
# other
# initialized once
Python/context.c - _token_missing -
-Python/fileutils.c - _Py_open_cloexec_works -
Python/hamt.c - _empty_bitmap_node -
Python/hamt.c - _empty_hamt -
@@ -384,6 +378,7 @@ Python/perf_trampoline.c - perf_map_file -
Objects/unicodeobject.c - ucnhash_capi -
Parser/action_helpers.c _PyPegen_dummy_name cache -
Python/dtoa.c - p5s -
+Python/fileutils.c - _Py_open_cloexec_works -
Python/fileutils.c - force_ascii -
Python/fileutils.c set_inheritable ioctl_works -
Python/import.c - import_lock -
@@ -511,6 +506,7 @@ Modules/_testcapi/vectorcall.c - MethodDescriptorNopGet_Type -
Modules/_testcapi/vectorcall.c - MethodDescriptor2_Type -
Modules/itertoolsmodule.c - _grouper_type -
Modules/itertoolsmodule.c - accumulate_type -
+Modules/itertoolsmodule.c - batched_type -
Modules/itertoolsmodule.c - chain_type -
Modules/itertoolsmodule.c - combinations_type -
Modules/itertoolsmodule.c - compress_type -
@@ -701,89 +697,6 @@ Modules/xxmodule.c - ErrorObject -
#-----------------------
# cached - initialized once
-# _Py_IDENTIFIER (global)
-Modules/_asynciomodule.c - PyId___asyncio_running_event_loop__ -
-Modules/_asynciomodule.c - PyId__asyncio_future_blocking -
-Modules/_asynciomodule.c - PyId_add_done_callback -
-Modules/_asynciomodule.c - PyId_call_soon -
-Modules/_asynciomodule.c - PyId_cancel -
-Modules/_asynciomodule.c - PyId_get_event_loop -
-Modules/_asynciomodule.c - PyId_throw -
-Modules/_datetimemodule.c - PyId_as_integer_ratio -
-Modules/_datetimemodule.c - PyId_fromutc -
-Modules/_datetimemodule.c - PyId_isoformat -
-Modules/_datetimemodule.c - PyId_strftime -
-
-# _Py_IDENTIFIER (local)
-Modules/_asynciomodule.c FutureObj_finalize PyId_call_exception_handler -
-Modules/_asynciomodule.c FutureObj_finalize PyId_exception -
-Modules/_asynciomodule.c FutureObj_finalize PyId_future -
-Modules/_asynciomodule.c FutureObj_finalize PyId_message -
-Modules/_asynciomodule.c FutureObj_finalize PyId_source_traceback -
-Modules/_asynciomodule.c FutureObj_get_state PyId_CANCELLED -
-Modules/_asynciomodule.c FutureObj_get_state PyId_FINISHED -
-Modules/_asynciomodule.c FutureObj_get_state PyId_PENDING -
-Modules/_asynciomodule.c TaskObj_finalize PyId_call_exception_handler -
-Modules/_asynciomodule.c TaskObj_finalize PyId_message -
-Modules/_asynciomodule.c TaskObj_finalize PyId_source_traceback -
-Modules/_asynciomodule.c TaskObj_finalize PyId_task -
-Modules/_asynciomodule.c future_init PyId_get_debug -
-Modules/_asynciomodule.c get_future_loop PyId__loop -
-Modules/_asynciomodule.c get_future_loop PyId_get_loop -
-Modules/_asynciomodule.c register_task PyId_add -
-Modules/_asynciomodule.c unregister_task PyId_discard -
-Modules/_ctypes/_ctypes.c CDataType_from_param PyId__as_parameter_ -
-Modules/_ctypes/_ctypes.c PyCArrayType_new PyId__length_ -
-Modules/_ctypes/_ctypes.c PyCArrayType_new PyId__type_ -
-Modules/_ctypes/_ctypes.c PyCFuncPtr_set_restype PyId__check_retval_ -
-Modules/_ctypes/_ctypes.c PyCPointerType_new PyId__type_ -
-Modules/_ctypes/_ctypes.c PyCPointerType_set_type PyId__type_ -
-Modules/_ctypes/_ctypes.c PyCSimpleType_from_param PyId__as_parameter_ -
-Modules/_ctypes/_ctypes.c PyCSimpleType_new PyId__type_ -
-Modules/_ctypes/_ctypes.c StructUnionType_new PyId__abstract_ -
-Modules/_ctypes/_ctypes.c StructUnionType_new PyId__fields_ -
-Modules/_ctypes/_ctypes.c _build_result PyId___ctypes_from_outparam__ -
-Modules/_ctypes/_ctypes.c _init_pos_args PyId__fields_ -
-Modules/_ctypes/_ctypes.c c_char_p_from_param PyId__as_parameter_ -
-Modules/_ctypes/_ctypes.c c_void_p_from_param PyId__as_parameter_ -
-Modules/_ctypes/_ctypes.c c_wchar_p_from_param PyId__as_parameter_ -
-Modules/_ctypes/_ctypes.c converters_from_argtypes PyId_from_param -
-Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__argtypes_ -
-Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__check_retval_ -
-Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__flags_ -
-Modules/_ctypes/_ctypes.c make_funcptrtype_dict PyId__restype_ -
-Modules/_ctypes/callproc.c ConvParam PyId__as_parameter_ -
-Modules/_ctypes/callproc.c unpickle PyId___new__ -
-Modules/_ctypes/callproc.c unpickle PyId___setstate__ -
-Modules/_ctypes/stgdict.c MakeAnonFields PyId__anonymous_ -
-Modules/_ctypes/stgdict.c PyCStructUnionType_update_stgdict PyId__pack_ -
-Modules/_ctypes/stgdict.c PyCStructUnionType_update_stgdict PyId__swappedbytes_ -
-Modules/_ctypes/stgdict.c PyCStructUnionType_update_stgdict PyId__use_broken_old_ctypes_structure_semantics_ -
-Modules/_cursesmodule.c _curses_getwin PyId_read -
-Modules/_cursesmodule.c _curses_window_putwin PyId_write -
-Modules/_cursesmodule.c update_lines_cols PyId_COLS -
-Modules/_cursesmodule.c update_lines_cols PyId_LINES -
-Modules/_datetimemodule.c call_tzname PyId_tzname -
-Modules/_datetimemodule.c date_strftime PyId_timetuple -
-Modules/_datetimemodule.c date_today PyId_fromtimestamp -
-Modules/_datetimemodule.c datetime_strptime PyId__strptime_datetime -
-Modules/_datetimemodule.c make_Zreplacement PyId_replace -
-Modules/_datetimemodule.c tzinfo_reduce PyId___getinitargs__ -
-Modules/_elementtree.c _elementtree_Element_find_impl PyId_find -
-Modules/_elementtree.c _elementtree_Element_findall_impl PyId_findall -
-Modules/_elementtree.c _elementtree_Element_findtext_impl PyId_findtext -
-Modules/_elementtree.c _elementtree_Element_iterfind_impl PyId_iterfind -
-Modules/_elementtree.c expat_start_doctype_handler PyId_doctype -
-Modules/_elementtree.c treebuilder_add_subelement PyId_append -
-Modules/_elementtree.c treebuilder_flush_data PyId_tail -
-Modules/_elementtree.c treebuilder_flush_data PyId_text -
-Modules/_json.c _encoded_const PyId_false -
-Modules/_json.c _encoded_const PyId_null -
-Modules/_json.c _encoded_const PyId_true -
-Modules/_json.c raise_errmsg PyId_JSONDecodeError -
-Modules/_json.c raise_errmsg PyId_decoder -
-Modules/ossaudiodev.c oss_exit PyId_close -
-
# manually cached PyUnicodeOjbect
Modules/_asynciomodule.c - context_kwname -
Modules/_ctypes/callproc.c _ctypes_get_errobj error_object_name -
diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv
index ea16ed2..6be61c94 100644
--- a/Tools/c-analyzer/cpython/ignored.tsv
+++ b/Tools/c-analyzer/cpython/ignored.tsv
@@ -261,6 +261,10 @@ Modules/_testcapimodule.c test_capsule buffer -
Modules/_testcapimodule.c test_empty_argparse kwlist -
Modules/_testcapimodule.c test_structmembers_new keywords -
Modules/_testcapimodule.c getargs_s_hash_int keywords -
+Modules/_testcapimodule.c - g_dict_watch_events -
+Modules/_testcapimodule.c - g_dict_watchers_installed -
+Modules/_testcapimodule.c - g_type_modified_events -
+Modules/_testcapimodule.c - g_type_watchers_installed -
Modules/_testimportmultiple.c - _barmodule -
Modules/_testimportmultiple.c - _foomodule -
Modules/_testimportmultiple.c - _testimportmultiple -
@@ -467,6 +471,7 @@ Objects/obmalloc.c - _PyObject -
Objects/obmalloc.c - usedpools -
Python/perf_trampoline.c - _Py_perfmap_callbacks -
Objects/typeobject.c - name_op -
+Objects/typeobject.c - slotdefs -
Objects/unicodeobject.c - stripfuncnames -
Objects/unicodeobject.c - utf7_category -
Objects/unicodeobject.c unicode_decode_call_errorhandler_wchar argparse -