Skip to content

Commit

Permalink
gh-90110: Clean Up the C-analyzer Globals Lists (gh-100091)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently authored Dec 7, 2022
1 parent d92407e commit d47ffeb
Show file tree
Hide file tree
Showing 4 changed files with 520 additions and 474 deletions.
3 changes: 2 additions & 1 deletion Parser/action_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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"
);
}
}
113 changes: 55 additions & 58 deletions Tools/c-analyzer/cpython/globals-to-fix.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down Expand Up @@ -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 -
Expand All @@ -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 -
Expand All @@ -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 -
Expand All @@ -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 -
Expand Down Expand Up @@ -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 -
Expand All @@ -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 -
Expand All @@ -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 -
Expand Down Expand Up @@ -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 -
Expand All @@ -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 -
Expand All @@ -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 -
Expand All @@ -420,18 +420,17 @@ 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 -
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 -
Expand Down Expand Up @@ -506,18 +505,18 @@ 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 -
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 -
Expand All @@ -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 -
Expand All @@ -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 -
Expand All @@ -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 -
Expand All @@ -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 -
Expand Down Expand Up @@ -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 -
Expand Down Expand Up @@ -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 -
Loading

0 comments on commit d47ffeb

Please sign in to comment.