diff --git a/Parser/action_helpers.c b/Parser/action_helpers.c index 27c093332f6..f12dad095ac 100644 --- a/Parser/action_helpers.c +++ b/Parser/action_helpers.c @@ -13,6 +13,7 @@ void * _PyPegen_dummy_name(Parser *p, ...) { // XXX This leaks memory from the initial arena. + // Use a statically allocated variable instead of a pointer? static void *cache = NULL; if (cache != NULL) { @@ -1287,4 +1288,4 @@ _PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args, asdl_comprehension_seq _PyPegen_get_last_comprehension_item(last_comprehension), "Generator expression must be parenthesized" ); -} \ No newline at end of file +} diff --git a/Tools/c-analyzer/cpython/globals-to-fix.tsv b/Tools/c-analyzer/cpython/globals-to-fix.tsv index adbb319a1b6..af5b7eb8eaf 100644 --- a/Tools/c-analyzer/cpython/globals-to-fix.tsv +++ b/Tools/c-analyzer/cpython/globals-to-fix.tsv @@ -4,10 +4,10 @@ filename funcname name reason # These are all variables that we will be making non-global. ################################## -# global objects to fix in core code +## global objects to fix in core code -#----------------------- -# exported builtin types (C-API) +##----------------------- +## exported builtin types (C-API) Objects/boolobject.c - PyBool_Type - Objects/bytearrayobject.c - PyByteArrayIter_Type - @@ -102,8 +102,8 @@ Python/context.c - PyContextVar_Type - Python/context.c - PyContext_Type - Python/traceback.c - PyTraceBack_Type - -#----------------------- -# other exported builtin types +##----------------------- +## other exported builtin types # Not in a .h file: Objects/codeobject.c - _PyLineIterator - @@ -126,8 +126,8 @@ Python/hamt.c - _PyHamt_CollisionNode_Type - Python/hamt.c - _PyHamt_Type - Python/symtable.c - PySTEntry_Type - -#----------------------- -# private static builtin types +##----------------------- +## private static builtin types Objects/setobject.c - _PySetDummy_Type - Objects/stringlib/unicode_format.h - PyFormatterIter_Type - @@ -136,8 +136,8 @@ Objects/unicodeobject.c - EncodingMapType - #Objects/unicodeobject.c - PyFieldNameIter_Type - #Objects/unicodeobject.c - PyFormatterIter_Type - -#----------------------- -# static builtin structseq +##----------------------- +## static builtin structseq Objects/floatobject.c - FloatInfoType - Objects/longobject.c - Int_InfoType - @@ -148,8 +148,8 @@ Python/sysmodule.c - Hash_InfoType - Python/sysmodule.c - VersionInfoType - Python/thread.c - ThreadInfoType - -#----------------------- -# builtin exception types +##----------------------- +## builtin exception types Objects/exceptions.c - _PyExc_BaseException - Objects/exceptions.c - _PyExc_BaseExceptionGroup - @@ -286,8 +286,8 @@ Objects/exceptions.c - PyExc_BytesWarning - Objects/exceptions.c - PyExc_ResourceWarning - Objects/exceptions.c - PyExc_EncodingWarning - -#----------------------- -# singletons +##----------------------- +## singletons Objects/boolobject.c - _Py_FalseStruct - Objects/boolobject.c - _Py_TrueStruct - @@ -300,26 +300,26 @@ Objects/sliceobject.c - _Py_EllipsisObject - ################################## -# global non-objects to fix in core code +## global non-objects to fix in core code -#----------------------- -# effectively-const but initialized lazily +##----------------------- +## effectively-const but initialized lazily -# idempotent +## idempotent Python/dtoa.c - p5s - Objects/obmalloc.c new_arena debug_stats - -# others +## others Python/perf_trampoline.c - perf_map_file - Objects/unicodeobject.c - ucnhash_capi - -#----------------------- -# state +##----------------------- +## state -# local buffer +## local buffer Python/suggestions.c levenshtein_distance buffer - -# other +## other Objects/object.c - _Py_RefTotal - Python/perf_trampoline.c - perf_status - Python/perf_trampoline.c - extra_code_index - @@ -329,10 +329,10 @@ Python/thread_pthread_stubs.h - py_tls_entries - ################################## -# global objects to fix in builtin modules +## global objects to fix in builtin modules -#----------------------- -# static types +##----------------------- +## static types Modules/_collectionsmodule.c - defdict_type - Modules/_collectionsmodule.c - deque_type - @@ -381,10 +381,10 @@ Modules/itertoolsmodule.c - tee_type - Modules/itertoolsmodule.c - teedataobject_type - Modules/itertoolsmodule.c - ziplongest_type - -#----------------------- -# other +##----------------------- +## other -# state +## state Modules/faulthandler.c - fatal_error - Modules/faulthandler.c - thread - Modules/faulthandler.c - user_signals - @@ -393,10 +393,10 @@ Modules/faulthandler.c - old_stack - ################################## -# global non-objects to fix in builtin modules +## global non-objects to fix in builtin modules -#----------------------- -# initialized once +##----------------------- +## initialized once Modules/_io/bufferedio.c _PyIO_trap_eintr eintr_int - Modules/posixmodule.c os_dup2_impl dup3_works - @@ -405,8 +405,8 @@ Modules/posixmodule.c - ticks_per_second - Modules/timemodule.c _PyTime_GetClockWithInfo initialized - Modules/timemodule.c _PyTime_GetProcessTimeWithInfo ticks_per_second - -#----------------------- -# state +##----------------------- +## state Modules/_tracemalloc.c - allocators - Modules/_tracemalloc.c - tables_lock - @@ -420,7 +420,6 @@ Modules/_tracemalloc.c - tracemalloc_traces - Modules/_tracemalloc.c - tracemalloc_domains - Modules/_tracemalloc.c - tracemalloc_reentrant_key - Modules/faulthandler.c faulthandler_dump_traceback reentrant - -Modules/posixmodule.c - environ - Modules/signalmodule.c - is_tripped - Modules/signalmodule.c - signal_global_state - Modules/signalmodule.c - wakeup - @@ -428,10 +427,10 @@ Modules/signalmodule.c - Handlers - ################################## -# global objects to fix in extension modules +## global objects to fix in extension modules -#----------------------- -# static types +##----------------------- +## static types Modules/_asynciomodule.c - FutureIterType - Modules/_asynciomodule.c - FutureType - @@ -506,10 +505,10 @@ Modules/xxmodule.c - Xxo_Type - Modules/xxsubtype.c - spamdict_type - Modules/xxsubtype.c - spamlist_type - -#----------------------- -# non-static types - initialized once +##----------------------- +## non-static types - initialized once -# heap types +## heap types Modules/_decimal/_decimal.c - DecimalTuple - Modules/_decimal/_decimal.c - PyDecSignalDict_Type - Modules/_tkinter.c - PyTclObject_Type - @@ -517,7 +516,7 @@ Modules/_tkinter.c - Tkapp_Type - Modules/_tkinter.c - Tktt_Type - Modules/xxlimited_35.c - Xxo_Type - -# exception types +## exception types Modules/_ctypes/_ctypes.c - PyExc_ArgError - Modules/_cursesmodule.c - PyCursesError - Modules/_decimal/_decimal.c - DecimalException - @@ -528,15 +527,15 @@ Modules/socketmodule.c - socket_gaierror - Modules/xxlimited_35.c - ErrorObject - Modules/xxmodule.c - ErrorObject - -#----------------------- -# cached - initialized once +##----------------------- +## cached - initialized once -# manually cached PyUnicodeOjbect +## manually cached PyUnicodeOjbect Modules/_asynciomodule.c - context_kwname - Modules/_ctypes/callproc.c _ctypes_get_errobj error_object_name - Modules/_ctypes/_ctypes.c CreateSwappedType suffix - -# other - during module init +## other - during module init Modules/_asynciomodule.c - asyncio_mod - Modules/_asynciomodule.c - traceback_extract_stack - Modules/_asynciomodule.c - asyncio_future_repr_func - @@ -551,10 +550,10 @@ Modules/_zoneinfo.c - io_open - Modules/_zoneinfo.c - _tzpath_find_tzfile - Modules/_zoneinfo.c - _common_mod - -#----------------------- -# other +##----------------------- +## other -# initialized once +## initialized once Modules/_ctypes/_ctypes.c - _unpickle - Modules/_ctypes/_ctypes.c PyCArrayType_from_ctype cache - Modules/_cursesmodule.c - ModDict - @@ -577,7 +576,7 @@ Modules/_decimal/_decimal.c - Rational - Modules/_decimal/_decimal.c - SignalTuple - Modules/arraymodule.c array_array___reduce_ex___impl array_reconstructor - -# state +## state Modules/_asynciomodule.c - cached_running_holder - Modules/_asynciomodule.c - fi_freelist - Modules/_asynciomodule.c - fi_freelist_len - @@ -592,20 +591,19 @@ Modules/_tkinter.c - valInCmd - Modules/_tkinter.c - trbInCmd - Modules/_zoneinfo.c - TIMEDELTA_CACHE - Modules/_zoneinfo.c - ZONEINFO_WEAK_CACHE - -Modules/syslogmodule.c - S_ident_o - ################################## -# global non-objects to fix in extension modules +## global non-objects to fix in extension modules -#----------------------- -# initialized once +##----------------------- +## initialized once -# pre-allocated buffer +## pre-allocated buffer Modules/nismodule.c nisproc_maplist_2 res - Modules/pyexpat.c PyUnknownEncodingHandler template_buffer - -# other +## other Include/datetime.h - PyDateTimeAPI - Modules/_asynciomodule.c - module_initialized - Modules/_ctypes/cfield.c _ctypes_get_fielddesc initialized - @@ -650,8 +648,8 @@ Modules/readline.c - libedit_history_start - Modules/socketmodule.c - accept4_works - Modules/socketmodule.c - sock_cloexec_works - -#----------------------- -# state +##----------------------- +## state Modules/_asynciomodule.c - cached_running_holder_tsid - Modules/_asynciomodule.c - task_name_counter - @@ -681,4 +679,3 @@ Modules/readline.c - completed_input_string - Modules/rotatingtree.c - random_stream - Modules/rotatingtree.c - random_value - Modules/socketmodule.c - defaulttimeout - -Modules/syslogmodule.c - S_log_open - diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv index 242deace8c9..128336a997e 100644 --- a/Tools/c-analyzer/cpython/ignored.tsv +++ b/Tools/c-analyzer/cpython/ignored.tsv @@ -5,52 +5,61 @@ filename funcname name reason ################################## -# process-global resources +## process-global values - set once -# Initialization for these should be idempotent. +# These will never re-initialize (but would be idempotent). +# These are effectively const. -#----------------------- -# effectively const, set once before/during first init +##----------------------- +## process-global resources - set during first init +## indicators for resource availability/capability +Python/bootstrap_hash.c py_getrandom getrandom_works - +Python/fileutils.c - _Py_open_cloexec_works - +Python/fileutils.c set_inheritable ioctl_works - + +## resource init +Python/thread.c - initialized - +Python/thread_pthread.h - condattr_monotonic - +# safe static buffer used during one-time initialization +Python/thread_pthread.h init_condattr ca - + +##----------------------- +## other values (not Python-specific) + +## cached computed data - set lazily (*after* first init) +# XXX Are these safe relative to write races? +Objects/longobject.c long_from_non_binary_base log_base_BASE - +Objects/longobject.c long_from_non_binary_base convwidth_base - +Objects/longobject.c long_from_non_binary_base convmultmax_base - +Objects/unicodeobject.c - bloom_linebreak - +# This is safe: +Objects/unicodeobject.c _init_global_state initialized - + +##----------------------- +## other values (Python-specific) + +## internal state - set before/during first init Modules/getbuildinfo.c - buildinfo - Modules/getbuildinfo.c - initialized - Python/getversion.c - initialized - Python/getversion.c - version - -#----------------------- -# effectively const, set once during first init - +## public C-API - set during first init Python/bootstrap_hash.c - _Py_HashSecret_Initialized - Python/pyhash.c - _Py_HashSecret - -Python/thread.c - initialized - -Python/thread_pthread.h - condattr_monotonic - -# safe static buffer used during one-time initialization -Python/thread_pthread.h init_condattr ca - - -# indicators for process-global resource availability/capability -Python/bootstrap_hash.c py_getrandom getrandom_works - -Python/fileutils.c - _Py_open_cloexec_works - -Python/fileutils.c set_inheritable ioctl_works - - -#----------------------- -# effectively const but set once lazily (*after* first init) - -Objects/longobject.c long_from_non_binary_base log_base_BASE - -Objects/longobject.c long_from_non_binary_base convwidth_base - -Objects/longobject.c long_from_non_binary_base convmultmax_base - -Objects/unicodeobject.c - bloom_linebreak - -Objects/unicodeobject.c _init_global_state initialized - - -# XXX Move to _PyRuntimeState? +## internal state - set lazily (*after* first init) +# XXX Move to _PyRuntimeState (i.e. tie to init/fini cycle)? Parser/action_helpers.c _PyPegen_dummy_name cache - ################################## -# state tied to C main() (only in main thread) +## state tied to Py_Main() +# (only in main thread) -#----------------------- -# handling C argv +##----------------------- +## handling C argv Python/getopt.c - _PyOS_optarg - Python/getopt.c - _PyOS_opterr - @@ -58,8 +67,8 @@ Python/getopt.c - _PyOS_optind - Python/getopt.c - opt_ptr - Python/pathconfig.c - _Py_path_config - -#----------------------- -# REPL +##----------------------- +## REPL Parser/myreadline.c - _PyOS_ReadlineLock - Parser/myreadline.c - _PyOS_ReadlineTState - @@ -68,28 +77,29 @@ Parser/myreadline.c - PyOS_ReadlineFunctionPointer - ################################## -# state tied to each runtime init/fini cycle +## runtime-global values - set once with each init -Python/pylifecycle.c - _PyRuntime - -Python/pylifecycle.c - runtime_initialized - +# These are effectively const. -# All uses of _PyArg_Parser are handled in c-analyzr/cpython/_analyzer.py. +##----------------------- +## set by embedders before init +# (whether directly or through a call) -#----------------------- -# effectively const once init finishes - -# set by embedders before init (whether directly or through a call) Python/initconfig.c - _Py_StandardStreamEncoding - Python/initconfig.c - _Py_StandardStreamErrors - +# XXX This only gets cleared by Py_Main(). Python/initconfig.c - orig_argv - -# deprecated +##----------------------- +## public C-API + +## deprecated Python/preconfig.c - Py_FileSystemDefaultEncoding - Python/preconfig.c - Py_HasFileSystemDefaultEncoding - Python/preconfig.c - Py_FileSystemDefaultEncodeErrors - Python/preconfig.c - _Py_HasFileSystemDefaultEncodeErrors - -# legacy config flags +## legacy config flags Python/initconfig.c - Py_UTF8Mode - Python/initconfig.c - Py_DebugFlag - Python/initconfig.c - Py_VerboseFlag - @@ -109,162 +119,243 @@ Python/initconfig.c - Py_IsolatedFlag - Python/initconfig.c - Py_LegacyWindowsFSEncodingFlag - Python/initconfig.c - Py_LegacyWindowsStdioFlag - -# initialized statically, customized by embedders +##----------------------- +## initialized statically, may be customized by embedders + Python/frozen.c - PyImport_FrozenModules - Python/import.c - inittab_copy - Python/import.c - PyImport_Inittab - -# used temporarily during init + +################################## +## runtime-global state + +##----------------------- +## tied to each init/fini cycle + +## the consolidated runtime state +Python/pylifecycle.c - _PyRuntime - +Python/pylifecycle.c - runtime_initialized - + +# All cases of _PyArg_Parser are handled in c-analyzr/cpython/_analyzer.py. + +## main interp state in stdlib modules +Modules/syslogmodule.c - S_ident_o - +Modules/syslogmodule.c - S_log_open - + +##----------------------- +## *not* tied to init/fini cycle + +# These do not ge reset with each init/fini cycle. +# XXX These should probably be tied to init/fini. Move to _PyRuntimeState? + +# special-use diagnistic state +Parser/pegen.c - memo_statistics - + +##----------------------- +## one-off temporary state + +# used during runtime init Python/sysmodule.c - _preinit_warnoptions - Python/sysmodule.c - _preinit_xoptions - - -################################## -# special-use diagnistic state - -Parser/pegen.c - memo_statistics - - - -################################## -# one-off temporary state - -# This is safe enough. +# thread-safety +# XXX need race protection? Python/pylifecycle.c _Py_FatalErrorFormat reentrant - Python/pylifecycle.c fatal_error reentrant - ################################## -# not used (kept for compatibility) +## not significant + +##----------------------- +## not used (kept for compatibility) Python/pyfpe.c - PyFPE_counter - +##----------------------- +## should be const +# XXX Make them const. -################################## -# The analyzer should have ignored these. -# XXX Fix the analyzer. +# These are all variables that we will be leaving global. -Modules/_io/_iomodule.c - _PyIO_Module - -Modules/_sqlite/module.c - _sqlite3module - +# All module defs, type defs, etc. are handled in c-analyzr/cpython/_analyzer.py. +# All kwlist arrays are handled in c-analyzr/cpython/_analyzer.py. -# forward/extern references +# other vars that are actually constant -Include/py_curses.h - PyCurses_API - -Include/pydecimal.h - _decimal_api - -Modules/_blake2/blake2module.c - blake2b_type_spec - -Modules/_blake2/blake2module.c - blake2s_type_spec - -Modules/_io/fileio.c - _Py_open_cloexec_works - -Modules/_io/_iomodule.h - PyIOBase_Type - -Modules/_io/_iomodule.h - PyRawIOBase_Type - -Modules/_io/_iomodule.h - PyBufferedIOBase_Type - -Modules/_io/_iomodule.h - PyTextIOBase_Type - -Modules/_io/_iomodule.h - PyFileIO_Type - -Modules/_io/_iomodule.h - PyBytesIO_Type - -Modules/_io/_iomodule.h - PyStringIO_Type - -Modules/_io/_iomodule.h - PyBufferedReader_Type - -Modules/_io/_iomodule.h - PyBufferedWriter_Type - -Modules/_io/_iomodule.h - PyBufferedRWPair_Type - -Modules/_io/_iomodule.h - PyBufferedRandom_Type - -Modules/_io/_iomodule.h - PyTextIOWrapper_Type - -Modules/_io/_iomodule.h - PyIncrementalNewlineDecoder_Type - -Modules/_io/_iomodule.h - _PyBytesIOBuffer_Type - -Modules/_io/_iomodule.h - _PyIO_Module - -Modules/_io/_iomodule.h - _PyIO_str_close - -Modules/_io/_iomodule.h - _PyIO_str_closed - -Modules/_io/_iomodule.h - _PyIO_str_decode - -Modules/_io/_iomodule.h - _PyIO_str_encode - -Modules/_io/_iomodule.h - _PyIO_str_fileno - -Modules/_io/_iomodule.h - _PyIO_str_flush - -Modules/_io/_iomodule.h - _PyIO_str_getstate - -Modules/_io/_iomodule.h - _PyIO_str_isatty - -Modules/_io/_iomodule.h - _PyIO_str_newlines - -Modules/_io/_iomodule.h - _PyIO_str_nl - -Modules/_io/_iomodule.h - _PyIO_str_peek - -Modules/_io/_iomodule.h - _PyIO_str_read - -Modules/_io/_iomodule.h - _PyIO_str_read1 - -Modules/_io/_iomodule.h - _PyIO_str_readable - -Modules/_io/_iomodule.h - _PyIO_str_readall - -Modules/_io/_iomodule.h - _PyIO_str_readinto - -Modules/_io/_iomodule.h - _PyIO_str_readline - -Modules/_io/_iomodule.h - _PyIO_str_reset - -Modules/_io/_iomodule.h - _PyIO_str_seek - -Modules/_io/_iomodule.h - _PyIO_str_seekable - -Modules/_io/_iomodule.h - _PyIO_str_setstate - -Modules/_io/_iomodule.h - _PyIO_str_tell - -Modules/_io/_iomodule.h - _PyIO_str_truncate - -Modules/_io/_iomodule.h - _PyIO_str_writable - -Modules/_io/_iomodule.h - _PyIO_str_write - -Modules/_io/_iomodule.h - _PyIO_empty_str - -Modules/_io/_iomodule.h - _PyIO_empty_bytes - -Modules/_multiprocessing/multiprocessing.h - _PyMp_SemLockType - -Modules/_sqlite/module.c - _pysqlite_converters - -Modules/_sqlite/module.c - _pysqlite_enable_callback_tracebacks - -Modules/_sqlite/module.c - pysqlite_BaseTypeAdapted - -Modules/_sqlite/module.h - pysqlite_global_state - -Modules/_testcapimodule.c - _PyBytesIOBuffer_Type - -Modules/posixmodule.c - _Py_open_cloexec_works - -Objects/object.c - _Py_GenericAliasIterType - -Objects/object.c - _PyMemoryIter_Type - -Objects/object.c - _PyLineIterator - -Objects/object.c - _PyPositionsIterator - -Python/perf_trampoline.c - _Py_trampoline_func_start - -Python/perf_trampoline.c - _Py_trampoline_func_end - -Python/importdl.h - _PyImport_DynLoadFiletab - +Include/internal/pycore_blocks_output_buffer.h - BUFFER_BLOCK_SIZE - +Modules/_csv.c - quote_styles - +Modules/_ctypes/cfield.c - ffi_type_double - +Modules/_ctypes/cfield.c - ffi_type_float - +Modules/_ctypes/cfield.c - ffi_type_longdouble - +Modules/_ctypes/cfield.c - ffi_type_pointer - +Modules/_ctypes/cfield.c - ffi_type_sint16 - +Modules/_ctypes/cfield.c - ffi_type_sint32 - +Modules/_ctypes/cfield.c - ffi_type_sint64 - +Modules/_ctypes/cfield.c - ffi_type_sint8 - +Modules/_ctypes/cfield.c - ffi_type_uint16 - +Modules/_ctypes/cfield.c - ffi_type_uint32 - +Modules/_ctypes/cfield.c - ffi_type_uint64 - +Modules/_ctypes/cfield.c - ffi_type_uint8 - +Modules/_ctypes/cfield.c - ffi_type_void - +Modules/_datetimemodule.c - epoch - +Modules/_datetimemodule.c - max_fold_seconds - +Modules/_datetimemodule.c datetime_isoformat specs - +Modules/_datetimemodule.c parse_hh_mm_ss_ff correction - +Modules/_datetimemodule.c time_isoformat specs - +Modules/_decimal/_decimal.c - cond_map - +Modules/_decimal/_decimal.c - dec_signal_string - +Modules/_decimal/_decimal.c - dflt_ctx - +Modules/_decimal/_decimal.c - int_constants - +Modules/_decimal/_decimal.c - invalid_rounding_err - +Modules/_decimal/_decimal.c - invalid_signals_err - +Modules/_decimal/_decimal.c - signal_map - +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 - +Modules/_sre/sre.c pattern_repr flag_names - +# XXX I'm pretty sure this is actually constant: +Modules/_sre/sre_targets.h - sre_targets - +Modules/_sre.c pattern_repr flag_names - +Modules/_struct.c - bigendian_table - +Modules/_struct.c - lilendian_table - +Modules/_tkinter.c - state_key - +Modules/_xxsubinterpretersmodule.c - _channelid_end_recv - +Modules/_xxsubinterpretersmodule.c - _channelid_end_send - +Modules/_zoneinfo.c - DAYS_BEFORE_MONTH - +Modules/_zoneinfo.c - DAYS_IN_MONTH - +Modules/arraymodule.c - descriptors - +Modules/arraymodule.c - emptybuf - +Modules/cjkcodecs/_codecs_cn.c - _mapping_list - +Modules/cjkcodecs/_codecs_cn.c - mapping_list - +Modules/cjkcodecs/_codecs_cn.c - _codec_list - +Modules/cjkcodecs/_codecs_cn.c - codec_list - +Modules/cjkcodecs/_codecs_hk.c - big5hkscs_pairenc_table - +Modules/cjkcodecs/_codecs_hk.c - _mapping_list - +Modules/cjkcodecs/_codecs_hk.c - mapping_list - +Modules/cjkcodecs/_codecs_hk.c - _codec_list - +Modules/cjkcodecs/_codecs_hk.c - codec_list - +Modules/cjkcodecs/_codecs_iso2022.c - iso2022_kr_config - +Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_config - +Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_1_config - +Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_2_config - +Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_2004_config - +Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_3_config - +Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_ext_config - +Modules/cjkcodecs/_codecs_iso2022.c - _mapping_list - +Modules/cjkcodecs/_codecs_iso2022.c - mapping_list - +Modules/cjkcodecs/_codecs_iso2022.c - _codec_list - +Modules/cjkcodecs/_codecs_iso2022.c - codec_list - +Modules/cjkcodecs/_codecs_jp.c - _mapping_list - +Modules/cjkcodecs/_codecs_jp.c - mapping_list - +Modules/cjkcodecs/_codecs_jp.c - _codec_list - +Modules/cjkcodecs/_codecs_jp.c - codec_list - +Modules/cjkcodecs/_codecs_kr.c - u2johabjamo - +Modules/cjkcodecs/_codecs_kr.c - _mapping_list - +Modules/cjkcodecs/_codecs_kr.c - mapping_list - +Modules/cjkcodecs/_codecs_kr.c - _codec_list - +Modules/cjkcodecs/_codecs_kr.c - codec_list - +Modules/cjkcodecs/_codecs_tw.c - _mapping_list - +Modules/cjkcodecs/_codecs_tw.c - mapping_list - +Modules/cjkcodecs/_codecs_tw.c - _codec_list - +Modules/cjkcodecs/_codecs_tw.c - codec_list - +Modules/cjkcodecs/cjkcodecs.h - __methods - +Modules/cmathmodule.c - acos_special_values - +Modules/cmathmodule.c - acosh_special_values - +Modules/cmathmodule.c - asinh_special_values - +Modules/cmathmodule.c - atanh_special_values - +Modules/cmathmodule.c - cosh_special_values - +Modules/cmathmodule.c - exp_special_values - +Modules/cmathmodule.c - log_special_values - +Modules/cmathmodule.c - rect_special_values - +Modules/cmathmodule.c - sinh_special_values - +Modules/cmathmodule.c - sqrt_special_values - +Modules/cmathmodule.c - tanh_special_values - +Modules/config.c - _PyImport_Inittab - +Modules/faulthandler.c - faulthandler_handlers - +Modules/getnameinfo.c - gni_afdl - +Modules/nismodule.c - TIMEOUT - +Modules/nismodule.c - aliases - +Modules/ossaudiodev.c - control_labels - +Modules/ossaudiodev.c - control_names - +Modules/posixmodule.c os_getxattr_impl buffer_sizes - +Modules/posixmodule.c os_listxattr_impl buffer_sizes - +Modules/posixmodule.c - posix_constants_confstr - +Modules/posixmodule.c - posix_constants_pathconf - +Modules/posixmodule.c - posix_constants_sysconf - +Modules/pyexpat.c - ExpatMemoryHandler - +Modules/pyexpat.c - error_info_of - +Modules/pyexpat.c - handler_info - +Modules/termios.c - termios_constants - +Modules/timemodule.c init_timezone YEAR - +Objects/bytearrayobject.c - _PyByteArray_empty_string - +Objects/complexobject.c - c_1 - +Objects/exceptions.c - static_exceptions - +Objects/genobject.c - ASYNC_GEN_IGNORED_EXIT_MSG - +Objects/genobject.c - NON_INIT_CORO_MSG - +Objects/longobject.c - _PyLong_DigitValue - +Objects/object.c - _Py_SwappedOp - +Objects/object.c - _Py_abstract_hack - +Objects/object.c - static_types - +Objects/obmalloc.c - _PyMem - +Objects/obmalloc.c - _PyMem_Debug - +Objects/obmalloc.c - _PyMem_Raw - +Objects/obmalloc.c - _PyObject - +Objects/obmalloc.c - usedpools - +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 - +Objects/unicodeobject.c unicode_decode_call_errorhandler_writer argparse - +Objects/unicodeobject.c unicode_encode_call_errorhandler argparse - +Objects/unicodeobject.c unicode_translate_call_errorhandler argparse - +Parser/parser.c - reserved_keywords - +Parser/parser.c - soft_keywords - +Parser/tokenizer.c - type_comment_prefix - +Python/ast_opt.c fold_unaryop ops - +Python/ceval.c - binary_ops - +Python/codecs.c - Py_hexdigits - +Python/codecs.c - ucnhash_capi - +Python/codecs.c _PyCodecRegistry_Init methods - +Python/compile.c - NO_LABEL - +Python/compile.c - NO_LOCATION - +Python/dynload_shlib.c - _PyImport_DynLoadFiletab - +Python/dynload_stub.c - _PyImport_DynLoadFiletab - +Python/frozen.c - aliases - +Python/frozen.c - bootstrap_modules - +Python/frozen.c - stdlib_modules - +Python/frozen.c - test_modules - +Python/frozen.c - _PyImport_FrozenAliases - +Python/frozen.c - _PyImport_FrozenBootstrap - +Python/frozen.c - _PyImport_FrozenStdlib - +Python/frozen.c - _PyImport_FrozenTest - +Python/getopt.c - longopts - +Python/import.c - _PyImport_Inittab - +Python/import.c - _PySys_ImplCacheTag - +Python/opcode_targets.h - opcode_targets - +Python/perf_trampoline.c - _Py_perfmap_callbacks - +Python/pyhash.c - PyHash_Func - +Python/pylifecycle.c - _C_LOCALE_WARNING - +Python/pylifecycle.c - _PyOS_mystrnicmp_hack - +Python/pylifecycle.c - _TARGET_LOCALES - +Python/pystate.c - initial - +Python/specialize.c - adaptive_opcodes - +Python/specialize.c - cache_requirements - +Python/specialize.c - compare_masks - +Python/stdlib_module_names.h - _Py_stdlib_module_names - +Python/sysmodule.c - _PySys_ImplCacheTag - +Python/sysmodule.c - _PySys_ImplName - +Python/sysmodule.c - whatstrings - -Modules/expat/xmlrole.c - prolog0 - -Modules/expat/xmlrole.c - prolog1 - -Modules/expat/xmlrole.c - prolog2 - -Modules/expat/xmlrole.c - doctype0 - -Modules/expat/xmlrole.c - doctype1 - -Modules/expat/xmlrole.c - doctype2 - -Modules/expat/xmlrole.c - doctype3 - -Modules/expat/xmlrole.c - doctype4 - -Modules/expat/xmlrole.c - doctype5 - -Modules/expat/xmlrole.c - internalSubset - -Modules/expat/xmlrole.c - entity0 - -Modules/expat/xmlrole.c - entity1 - -Modules/expat/xmlrole.c - entity2 - -Modules/expat/xmlrole.c - entity3 - -Modules/expat/xmlrole.c - entity4 - -Modules/expat/xmlrole.c - entity5 - -Modules/expat/xmlrole.c - entity6 - -Modules/expat/xmlrole.c - entity7 - -Modules/expat/xmlrole.c - entity8 - -Modules/expat/xmlrole.c - entity9 - -Modules/expat/xmlrole.c - entity10 - -Modules/expat/xmlrole.c - notation0 - -Modules/expat/xmlrole.c - notation1 - -Modules/expat/xmlrole.c - notation2 - -Modules/expat/xmlrole.c - notation3 - -Modules/expat/xmlrole.c - notation4 - -Modules/expat/xmlrole.c - attlist0 - -Modules/expat/xmlrole.c - attlist1 - -Modules/expat/xmlrole.c - attlist2 - -Modules/expat/xmlrole.c - attlist3 - -Modules/expat/xmlrole.c - attlist4 - -Modules/expat/xmlrole.c - attlist5 - -Modules/expat/xmlrole.c - attlist6 - -Modules/expat/xmlrole.c - attlist7 - -Modules/expat/xmlrole.c - attlist8 - -Modules/expat/xmlrole.c - attlist9 - -Modules/expat/xmlrole.c - element0 - -Modules/expat/xmlrole.c - element1 - -Modules/expat/xmlrole.c - element2 - -Modules/expat/xmlrole.c - element3 - -Modules/expat/xmlrole.c - element4 - -Modules/expat/xmlrole.c - element5 - -Modules/expat/xmlrole.c - element6 - -Modules/expat/xmlrole.c - element7 - -Modules/expat/xmlrole.c - externalSubset0 - -Modules/expat/xmlrole.c - externalSubset1 - -Modules/expat/xmlrole.c - condSect0 - -Modules/expat/xmlrole.c - condSect1 - -Modules/expat/xmlrole.c - condSect2 - -Modules/expat/xmlrole.c - declClose - -Modules/expat/xmlrole.c - error - - - -################################## -# test code +##----------------------- +## test code Modules/_ctypes/_ctypes_test.c - _ctypes_test_slots - Modules/_ctypes/_ctypes_test.c - _ctypes_testmodule - @@ -464,185 +555,125 @@ Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput SRE_MATCH_INITIALIZED - Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput STRUCT_UNPACK_INITIALIZED - Modules/_xxtestfuzz/fuzzer.c LLVMFuzzerTestOneInput AST_LITERAL_EVAL_INITIALIZED - +##----------------------- +## the analyzer should have ignored these +# XXX Fix the analyzer. -################################## -# should be const -# XXX Make them const. +## forward/extern references +Include/py_curses.h - PyCurses_API - +Include/pydecimal.h - _decimal_api - +Modules/_blake2/blake2module.c - blake2b_type_spec - +Modules/_blake2/blake2module.c - blake2s_type_spec - +Modules/_io/fileio.c - _Py_open_cloexec_works - +Modules/_io/_iomodule.h - PyIOBase_Type - +Modules/_io/_iomodule.h - PyRawIOBase_Type - +Modules/_io/_iomodule.h - PyBufferedIOBase_Type - +Modules/_io/_iomodule.h - PyTextIOBase_Type - +Modules/_io/_iomodule.h - PyFileIO_Type - +Modules/_io/_iomodule.h - PyBytesIO_Type - +Modules/_io/_iomodule.h - PyStringIO_Type - +Modules/_io/_iomodule.h - PyBufferedReader_Type - +Modules/_io/_iomodule.h - PyBufferedWriter_Type - +Modules/_io/_iomodule.h - PyBufferedRWPair_Type - +Modules/_io/_iomodule.h - PyBufferedRandom_Type - +Modules/_io/_iomodule.h - PyTextIOWrapper_Type - +Modules/_io/_iomodule.h - PyIncrementalNewlineDecoder_Type - +Modules/_io/_iomodule.h - _PyBytesIOBuffer_Type - +Modules/_io/_iomodule.h - _PyIO_Module - +Modules/_io/_iomodule.h - _PyIO_str_close - +Modules/_io/_iomodule.h - _PyIO_str_closed - +Modules/_io/_iomodule.h - _PyIO_str_decode - +Modules/_io/_iomodule.h - _PyIO_str_encode - +Modules/_io/_iomodule.h - _PyIO_str_fileno - +Modules/_io/_iomodule.h - _PyIO_str_flush - +Modules/_io/_iomodule.h - _PyIO_str_getstate - +Modules/_io/_iomodule.h - _PyIO_str_isatty - +Modules/_io/_iomodule.h - _PyIO_str_newlines - +Modules/_io/_iomodule.h - _PyIO_str_nl - +Modules/_io/_iomodule.h - _PyIO_str_peek - +Modules/_io/_iomodule.h - _PyIO_str_read - +Modules/_io/_iomodule.h - _PyIO_str_read1 - +Modules/_io/_iomodule.h - _PyIO_str_readable - +Modules/_io/_iomodule.h - _PyIO_str_readall - +Modules/_io/_iomodule.h - _PyIO_str_readinto - +Modules/_io/_iomodule.h - _PyIO_str_readline - +Modules/_io/_iomodule.h - _PyIO_str_reset - +Modules/_io/_iomodule.h - _PyIO_str_seek - +Modules/_io/_iomodule.h - _PyIO_str_seekable - +Modules/_io/_iomodule.h - _PyIO_str_setstate - +Modules/_io/_iomodule.h - _PyIO_str_tell - +Modules/_io/_iomodule.h - _PyIO_str_truncate - +Modules/_io/_iomodule.h - _PyIO_str_writable - +Modules/_io/_iomodule.h - _PyIO_str_write - +Modules/_io/_iomodule.h - _PyIO_empty_str - +Modules/_io/_iomodule.h - _PyIO_empty_bytes - +Modules/_multiprocessing/multiprocessing.h - _PyMp_SemLockType - +Modules/_sqlite/module.c - _pysqlite_converters - +Modules/_sqlite/module.c - _pysqlite_enable_callback_tracebacks - +Modules/_sqlite/module.c - pysqlite_BaseTypeAdapted - +Modules/_sqlite/module.h - pysqlite_global_state - +Modules/_testcapimodule.c - _PyBytesIOBuffer_Type - +Modules/posixmodule.c - _Py_open_cloexec_works - +Modules/posixmodule.c - environ - +Objects/object.c - _Py_GenericAliasIterType - +Objects/object.c - _PyMemoryIter_Type - +Objects/object.c - _PyLineIterator - +Objects/object.c - _PyPositionsIterator - +Python/perf_trampoline.c - _Py_trampoline_func_start - +Python/perf_trampoline.c - _Py_trampoline_func_end - +Python/importdl.h - _PyImport_DynLoadFiletab - +Modules/expat/xmlrole.c - prolog0 - +Modules/expat/xmlrole.c - prolog1 - +Modules/expat/xmlrole.c - prolog2 - +Modules/expat/xmlrole.c - doctype0 - +Modules/expat/xmlrole.c - doctype1 - +Modules/expat/xmlrole.c - doctype2 - +Modules/expat/xmlrole.c - doctype3 - +Modules/expat/xmlrole.c - doctype4 - +Modules/expat/xmlrole.c - doctype5 - +Modules/expat/xmlrole.c - internalSubset - +Modules/expat/xmlrole.c - entity0 - +Modules/expat/xmlrole.c - entity1 - +Modules/expat/xmlrole.c - entity2 - +Modules/expat/xmlrole.c - entity3 - +Modules/expat/xmlrole.c - entity4 - +Modules/expat/xmlrole.c - entity5 - +Modules/expat/xmlrole.c - entity6 - +Modules/expat/xmlrole.c - entity7 - +Modules/expat/xmlrole.c - entity8 - +Modules/expat/xmlrole.c - entity9 - +Modules/expat/xmlrole.c - entity10 - +Modules/expat/xmlrole.c - notation0 - +Modules/expat/xmlrole.c - notation1 - +Modules/expat/xmlrole.c - notation2 - +Modules/expat/xmlrole.c - notation3 - +Modules/expat/xmlrole.c - notation4 - +Modules/expat/xmlrole.c - attlist0 - +Modules/expat/xmlrole.c - attlist1 - +Modules/expat/xmlrole.c - attlist2 - +Modules/expat/xmlrole.c - attlist3 - +Modules/expat/xmlrole.c - attlist4 - +Modules/expat/xmlrole.c - attlist5 - +Modules/expat/xmlrole.c - attlist6 - +Modules/expat/xmlrole.c - attlist7 - +Modules/expat/xmlrole.c - attlist8 - +Modules/expat/xmlrole.c - attlist9 - +Modules/expat/xmlrole.c - element0 - +Modules/expat/xmlrole.c - element1 - +Modules/expat/xmlrole.c - element2 - +Modules/expat/xmlrole.c - element3 - +Modules/expat/xmlrole.c - element4 - +Modules/expat/xmlrole.c - element5 - +Modules/expat/xmlrole.c - element6 - +Modules/expat/xmlrole.c - element7 - +Modules/expat/xmlrole.c - externalSubset0 - +Modules/expat/xmlrole.c - externalSubset1 - +Modules/expat/xmlrole.c - condSect0 - +Modules/expat/xmlrole.c - condSect1 - +Modules/expat/xmlrole.c - condSect2 - +Modules/expat/xmlrole.c - declClose - +Modules/expat/xmlrole.c - error - -# These are all variables that we will be leaving global. - -# All module defs, type defs, etc. are handled in c-analyzr/cpython/_analyzer.py. -# All kwlist arrays are handled in c-analyzr/cpython/_analyzer.py. - -#----------------------- -# other vars that are actually constant - -Include/internal/pycore_blocks_output_buffer.h - BUFFER_BLOCK_SIZE - -Modules/_csv.c - quote_styles - -Modules/_ctypes/cfield.c - ffi_type_double - -Modules/_ctypes/cfield.c - ffi_type_float - -Modules/_ctypes/cfield.c - ffi_type_longdouble - -Modules/_ctypes/cfield.c - ffi_type_pointer - -Modules/_ctypes/cfield.c - ffi_type_sint16 - -Modules/_ctypes/cfield.c - ffi_type_sint32 - -Modules/_ctypes/cfield.c - ffi_type_sint64 - -Modules/_ctypes/cfield.c - ffi_type_sint8 - -Modules/_ctypes/cfield.c - ffi_type_uint16 - -Modules/_ctypes/cfield.c - ffi_type_uint32 - -Modules/_ctypes/cfield.c - ffi_type_uint64 - -Modules/_ctypes/cfield.c - ffi_type_uint8 - -Modules/_ctypes/cfield.c - ffi_type_void - -Modules/_datetimemodule.c - epoch - -Modules/_datetimemodule.c - max_fold_seconds - -Modules/_datetimemodule.c datetime_isoformat specs - -Modules/_datetimemodule.c parse_hh_mm_ss_ff correction - -Modules/_datetimemodule.c time_isoformat specs - -Modules/_decimal/_decimal.c - cond_map - -Modules/_decimal/_decimal.c - dec_signal_string - -Modules/_decimal/_decimal.c - dflt_ctx - -Modules/_decimal/_decimal.c - int_constants - -Modules/_decimal/_decimal.c - invalid_rounding_err - -Modules/_decimal/_decimal.c - invalid_signals_err - -Modules/_decimal/_decimal.c - signal_map - -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 - -Modules/_sre/sre.c pattern_repr flag_names - -# XXX I'm pretty sure this is actually constant: -Modules/_sre/sre_targets.h - sre_targets - -Modules/_sre.c pattern_repr flag_names - -Modules/_struct.c - bigendian_table - -Modules/_struct.c - lilendian_table - -Modules/_tkinter.c - state_key - -Modules/_xxsubinterpretersmodule.c - _channelid_end_recv - -Modules/_xxsubinterpretersmodule.c - _channelid_end_send - -Modules/_zoneinfo.c - DAYS_BEFORE_MONTH - -Modules/_zoneinfo.c - DAYS_IN_MONTH - -Modules/arraymodule.c - descriptors - -Modules/arraymodule.c - emptybuf - -Modules/cjkcodecs/_codecs_cn.c - _mapping_list - -Modules/cjkcodecs/_codecs_cn.c - mapping_list - -Modules/cjkcodecs/_codecs_cn.c - _codec_list - -Modules/cjkcodecs/_codecs_cn.c - codec_list - -Modules/cjkcodecs/_codecs_hk.c - big5hkscs_pairenc_table - -Modules/cjkcodecs/_codecs_hk.c - _mapping_list - -Modules/cjkcodecs/_codecs_hk.c - mapping_list - -Modules/cjkcodecs/_codecs_hk.c - _codec_list - -Modules/cjkcodecs/_codecs_hk.c - codec_list - -Modules/cjkcodecs/_codecs_iso2022.c - iso2022_kr_config - -Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_config - -Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_1_config - -Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_2_config - -Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_2004_config - -Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_3_config - -Modules/cjkcodecs/_codecs_iso2022.c - iso2022_jp_ext_config - -Modules/cjkcodecs/_codecs_iso2022.c - _mapping_list - -Modules/cjkcodecs/_codecs_iso2022.c - mapping_list - -Modules/cjkcodecs/_codecs_iso2022.c - _codec_list - -Modules/cjkcodecs/_codecs_iso2022.c - codec_list - -Modules/cjkcodecs/_codecs_jp.c - _mapping_list - -Modules/cjkcodecs/_codecs_jp.c - mapping_list - -Modules/cjkcodecs/_codecs_jp.c - _codec_list - -Modules/cjkcodecs/_codecs_jp.c - codec_list - -Modules/cjkcodecs/_codecs_kr.c - u2johabjamo - -Modules/cjkcodecs/_codecs_kr.c - _mapping_list - -Modules/cjkcodecs/_codecs_kr.c - mapping_list - -Modules/cjkcodecs/_codecs_kr.c - _codec_list - -Modules/cjkcodecs/_codecs_kr.c - codec_list - -Modules/cjkcodecs/_codecs_tw.c - _mapping_list - -Modules/cjkcodecs/_codecs_tw.c - mapping_list - -Modules/cjkcodecs/_codecs_tw.c - _codec_list - -Modules/cjkcodecs/_codecs_tw.c - codec_list - -Modules/cjkcodecs/cjkcodecs.h - __methods - -Modules/cmathmodule.c - acos_special_values - -Modules/cmathmodule.c - acosh_special_values - -Modules/cmathmodule.c - asinh_special_values - -Modules/cmathmodule.c - atanh_special_values - -Modules/cmathmodule.c - cosh_special_values - -Modules/cmathmodule.c - exp_special_values - -Modules/cmathmodule.c - log_special_values - -Modules/cmathmodule.c - rect_special_values - -Modules/cmathmodule.c - sinh_special_values - -Modules/cmathmodule.c - sqrt_special_values - -Modules/cmathmodule.c - tanh_special_values - -Modules/config.c - _PyImport_Inittab - -Modules/faulthandler.c - faulthandler_handlers - -Modules/getnameinfo.c - gni_afdl - -Modules/nismodule.c - TIMEOUT - -Modules/nismodule.c - aliases - -Modules/ossaudiodev.c - control_labels - -Modules/ossaudiodev.c - control_names - -Modules/posixmodule.c os_getxattr_impl buffer_sizes - -Modules/posixmodule.c os_listxattr_impl buffer_sizes - -Modules/posixmodule.c - posix_constants_confstr - -Modules/posixmodule.c - posix_constants_pathconf - -Modules/posixmodule.c - posix_constants_sysconf - -Modules/pyexpat.c - ExpatMemoryHandler - -Modules/pyexpat.c - error_info_of - -Modules/pyexpat.c - handler_info - -Modules/termios.c - termios_constants - -Modules/timemodule.c init_timezone YEAR - -Objects/bytearrayobject.c - _PyByteArray_empty_string - -Objects/complexobject.c - c_1 - -Objects/exceptions.c - static_exceptions - -Objects/genobject.c - ASYNC_GEN_IGNORED_EXIT_MSG - -Objects/genobject.c - NON_INIT_CORO_MSG - -Objects/longobject.c - _PyLong_DigitValue - -Objects/object.c - _Py_SwappedOp - -Objects/object.c - _Py_abstract_hack - -Objects/object.c - static_types - -Objects/obmalloc.c - _PyMem - -Objects/obmalloc.c - _PyMem_Debug - -Objects/obmalloc.c - _PyMem_Raw - -Objects/obmalloc.c - _PyObject - -Objects/obmalloc.c - usedpools - -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 - -Objects/unicodeobject.c unicode_decode_call_errorhandler_writer argparse - -Objects/unicodeobject.c unicode_encode_call_errorhandler argparse - -Objects/unicodeobject.c unicode_translate_call_errorhandler argparse - -Parser/parser.c - reserved_keywords - -Parser/parser.c - soft_keywords - -Parser/tokenizer.c - type_comment_prefix - -Python/ast_opt.c fold_unaryop ops - -Python/ceval.c - binary_ops - -Python/codecs.c - Py_hexdigits - -Python/codecs.c - ucnhash_capi - -Python/codecs.c _PyCodecRegistry_Init methods - -Python/compile.c - NO_LABEL - -Python/compile.c - NO_LOCATION - -Python/dynload_shlib.c - _PyImport_DynLoadFiletab - -Python/dynload_stub.c - _PyImport_DynLoadFiletab - -Python/frozen.c - aliases - -Python/frozen.c - bootstrap_modules - -Python/frozen.c - stdlib_modules - -Python/frozen.c - test_modules - -Python/frozen.c - _PyImport_FrozenAliases - -Python/frozen.c - _PyImport_FrozenBootstrap - -Python/frozen.c - _PyImport_FrozenStdlib - -Python/frozen.c - _PyImport_FrozenTest - -Python/getopt.c - longopts - -Python/import.c - _PyImport_Inittab - -Python/import.c - _PySys_ImplCacheTag - -Python/opcode_targets.h - opcode_targets - -Python/perf_trampoline.c - _Py_perfmap_callbacks - -Python/pyhash.c - PyHash_Func - -Python/pylifecycle.c - _C_LOCALE_WARNING - -Python/pylifecycle.c - _PyOS_mystrnicmp_hack - -Python/pylifecycle.c - _TARGET_LOCALES - -Python/pystate.c - initial - -Python/specialize.c - adaptive_opcodes - -Python/specialize.c - cache_requirements - -Python/specialize.c - compare_masks - -Python/stdlib_module_names.h - _Py_stdlib_module_names - -Python/sysmodule.c - _PySys_ImplCacheTag - -Python/sysmodule.c - _PySys_ImplName - -Python/sysmodule.c - whatstrings - +## other +Modules/_io/_iomodule.c - _PyIO_Module - +Modules/_sqlite/module.c - _sqlite3module - diff --git a/Tools/c-analyzer/table-file.py b/Tools/c-analyzer/table-file.py index 3cc05cc9de7..d36f814415c 100644 --- a/Tools/c-analyzer/table-file.py +++ b/Tools/c-analyzer/table-file.py @@ -1,43 +1,59 @@ +KINDS = [ + 'section-major', + 'section-minor', + 'section-group', + 'row', +] + + def iter_clean_lines(lines): lines = iter(lines) - for line in lines: - line = line.strip() - if line.startswith('# XXX'): + for rawline in lines: + line = rawline.strip() + if line.startswith('#') and not rawline.startswith('##'): continue - yield line + yield line, rawline def parse_table_lines(lines): lines = iter_clean_lines(lines) - for line in lines: - if line.startswith(('####', '#----')): - kind = 0 if line[1] == '#' else 1 - try: - line = next(lines).strip() - except StopIteration: - line = '' - if not line.startswith('# '): - raise NotImplementedError(line) - yield kind, line[2:].lstrip() - continue - - maybe = None - while line.startswith('#'): - if line != '#' and line[1] == ' ': - maybe = line[2:].lstrip() - try: - line = next(lines).strip() - except StopIteration: - return - if not line: - break - else: - if line: - if maybe: - yield 2, maybe - yield 'row', line + group = None + prev = '' + for line, rawline in lines: + if line.startswith('## '): + assert not rawline.startswith(' '), (line, rawline) + if group: + assert prev, (line, rawline) + kind, after, _ = group + assert kind and kind != 'section-group', (group, line, rawline) + assert after is not None, (group, line, rawline) + else: + assert not prev, (prev, line, rawline) + kind, after = group = ('section-group', None) + title = line[3:].lstrip() + assert title, (line, rawline) + if after is not None: + try: + line, rawline = next(lines) + except StopIteration: + line = None + if line != after: + raise NotImplementedError((group, line, rawline)) + yield kind, title + group = None + elif group: + raise NotImplementedError((group, line, rawline)) + elif line.startswith('##---'): + assert line.rstrip('-') == '##', (line, rawline) + group = ('section-minor', '', line) + elif line.startswith('#####'): + assert not line.strip('#'), (line, rawline) + group = ('section-major', '', line) + elif line: + yield 'row', line + prev = line def iter_sections(lines): @@ -49,12 +65,13 @@ def iter_sections(lines): if header is None: header = value continue - raise NotImplementedError(value) + raise NotImplementedError(repr(value)) yield tuple(section), value else: if header is None: header = False - section[kind:] = [value] + start = KINDS.index(kind) + section[start:] = [value] def collect_sections(lines):