Skip to content

Commit d47ffeb

Browse files
gh-90110: Clean Up the C-analyzer Globals Lists (gh-100091)
#90110
1 parent d92407e commit d47ffeb

File tree

4 files changed

+520
-474
lines changed

4 files changed

+520
-474
lines changed

Parser/action_helpers.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ void *
1313
_PyPegen_dummy_name(Parser *p, ...)
1414
{
1515
// XXX This leaks memory from the initial arena.
16+
// Use a statically allocated variable instead of a pointer?
1617
static void *cache = NULL;
1718

1819
if (cache != NULL) {
@@ -1287,4 +1288,4 @@ _PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args, asdl_comprehension_seq
12871288
_PyPegen_get_last_comprehension_item(last_comprehension),
12881289
"Generator expression must be parenthesized"
12891290
);
1290-
}
1291+
}

Tools/c-analyzer/cpython/globals-to-fix.tsv

+55-58
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ filename funcname name reason
44
# These are all variables that we will be making non-global.
55

66
##################################
7-
# global objects to fix in core code
7+
## global objects to fix in core code
88

9-
#-----------------------
10-
# exported builtin types (C-API)
9+
##-----------------------
10+
## exported builtin types (C-API)
1111

1212
Objects/boolobject.c - PyBool_Type -
1313
Objects/bytearrayobject.c - PyByteArrayIter_Type -
@@ -102,8 +102,8 @@ Python/context.c - PyContextVar_Type -
102102
Python/context.c - PyContext_Type -
103103
Python/traceback.c - PyTraceBack_Type -
104104

105-
#-----------------------
106-
# other exported builtin types
105+
##-----------------------
106+
## other exported builtin types
107107

108108
# Not in a .h file:
109109
Objects/codeobject.c - _PyLineIterator -
@@ -126,8 +126,8 @@ Python/hamt.c - _PyHamt_CollisionNode_Type -
126126
Python/hamt.c - _PyHamt_Type -
127127
Python/symtable.c - PySTEntry_Type -
128128

129-
#-----------------------
130-
# private static builtin types
129+
##-----------------------
130+
## private static builtin types
131131

132132
Objects/setobject.c - _PySetDummy_Type -
133133
Objects/stringlib/unicode_format.h - PyFormatterIter_Type -
@@ -136,8 +136,8 @@ Objects/unicodeobject.c - EncodingMapType -
136136
#Objects/unicodeobject.c - PyFieldNameIter_Type -
137137
#Objects/unicodeobject.c - PyFormatterIter_Type -
138138

139-
#-----------------------
140-
# static builtin structseq
139+
##-----------------------
140+
## static builtin structseq
141141

142142
Objects/floatobject.c - FloatInfoType -
143143
Objects/longobject.c - Int_InfoType -
@@ -148,8 +148,8 @@ Python/sysmodule.c - Hash_InfoType -
148148
Python/sysmodule.c - VersionInfoType -
149149
Python/thread.c - ThreadInfoType -
150150

151-
#-----------------------
152-
# builtin exception types
151+
##-----------------------
152+
## builtin exception types
153153

154154
Objects/exceptions.c - _PyExc_BaseException -
155155
Objects/exceptions.c - _PyExc_BaseExceptionGroup -
@@ -286,8 +286,8 @@ Objects/exceptions.c - PyExc_BytesWarning -
286286
Objects/exceptions.c - PyExc_ResourceWarning -
287287
Objects/exceptions.c - PyExc_EncodingWarning -
288288

289-
#-----------------------
290-
# singletons
289+
##-----------------------
290+
## singletons
291291

292292
Objects/boolobject.c - _Py_FalseStruct -
293293
Objects/boolobject.c - _Py_TrueStruct -
@@ -300,26 +300,26 @@ Objects/sliceobject.c - _Py_EllipsisObject -
300300

301301

302302
##################################
303-
# global non-objects to fix in core code
303+
## global non-objects to fix in core code
304304

305-
#-----------------------
306-
# effectively-const but initialized lazily
305+
##-----------------------
306+
## effectively-const but initialized lazily
307307

308-
# idempotent
308+
## idempotent
309309
Python/dtoa.c - p5s -
310310
Objects/obmalloc.c new_arena debug_stats -
311311

312-
# others
312+
## others
313313
Python/perf_trampoline.c - perf_map_file -
314314
Objects/unicodeobject.c - ucnhash_capi -
315315

316-
#-----------------------
317-
# state
316+
##-----------------------
317+
## state
318318

319-
# local buffer
319+
## local buffer
320320
Python/suggestions.c levenshtein_distance buffer -
321321

322-
# other
322+
## other
323323
Objects/object.c - _Py_RefTotal -
324324
Python/perf_trampoline.c - perf_status -
325325
Python/perf_trampoline.c - extra_code_index -
@@ -329,10 +329,10 @@ Python/thread_pthread_stubs.h - py_tls_entries -
329329

330330

331331
##################################
332-
# global objects to fix in builtin modules
332+
## global objects to fix in builtin modules
333333

334-
#-----------------------
335-
# static types
334+
##-----------------------
335+
## static types
336336

337337
Modules/_collectionsmodule.c - defdict_type -
338338
Modules/_collectionsmodule.c - deque_type -
@@ -381,10 +381,10 @@ Modules/itertoolsmodule.c - tee_type -
381381
Modules/itertoolsmodule.c - teedataobject_type -
382382
Modules/itertoolsmodule.c - ziplongest_type -
383383

384-
#-----------------------
385-
# other
384+
##-----------------------
385+
## other
386386

387-
# state
387+
## state
388388
Modules/faulthandler.c - fatal_error -
389389
Modules/faulthandler.c - thread -
390390
Modules/faulthandler.c - user_signals -
@@ -393,10 +393,10 @@ Modules/faulthandler.c - old_stack -
393393

394394

395395
##################################
396-
# global non-objects to fix in builtin modules
396+
## global non-objects to fix in builtin modules
397397

398-
#-----------------------
399-
# initialized once
398+
##-----------------------
399+
## initialized once
400400

401401
Modules/_io/bufferedio.c _PyIO_trap_eintr eintr_int -
402402
Modules/posixmodule.c os_dup2_impl dup3_works -
@@ -405,8 +405,8 @@ Modules/posixmodule.c - ticks_per_second -
405405
Modules/timemodule.c _PyTime_GetClockWithInfo initialized -
406406
Modules/timemodule.c _PyTime_GetProcessTimeWithInfo ticks_per_second -
407407

408-
#-----------------------
409-
# state
408+
##-----------------------
409+
## state
410410

411411
Modules/_tracemalloc.c - allocators -
412412
Modules/_tracemalloc.c - tables_lock -
@@ -420,18 +420,17 @@ Modules/_tracemalloc.c - tracemalloc_traces -
420420
Modules/_tracemalloc.c - tracemalloc_domains -
421421
Modules/_tracemalloc.c - tracemalloc_reentrant_key -
422422
Modules/faulthandler.c faulthandler_dump_traceback reentrant -
423-
Modules/posixmodule.c - environ -
424423
Modules/signalmodule.c - is_tripped -
425424
Modules/signalmodule.c - signal_global_state -
426425
Modules/signalmodule.c - wakeup -
427426
Modules/signalmodule.c - Handlers -
428427

429428

430429
##################################
431-
# global objects to fix in extension modules
430+
## global objects to fix in extension modules
432431

433-
#-----------------------
434-
# static types
432+
##-----------------------
433+
## static types
435434

436435
Modules/_asynciomodule.c - FutureIterType -
437436
Modules/_asynciomodule.c - FutureType -
@@ -506,18 +505,18 @@ Modules/xxmodule.c - Xxo_Type -
506505
Modules/xxsubtype.c - spamdict_type -
507506
Modules/xxsubtype.c - spamlist_type -
508507

509-
#-----------------------
510-
# non-static types - initialized once
508+
##-----------------------
509+
## non-static types - initialized once
511510

512-
# heap types
511+
## heap types
513512
Modules/_decimal/_decimal.c - DecimalTuple -
514513
Modules/_decimal/_decimal.c - PyDecSignalDict_Type -
515514
Modules/_tkinter.c - PyTclObject_Type -
516515
Modules/_tkinter.c - Tkapp_Type -
517516
Modules/_tkinter.c - Tktt_Type -
518517
Modules/xxlimited_35.c - Xxo_Type -
519518

520-
# exception types
519+
## exception types
521520
Modules/_ctypes/_ctypes.c - PyExc_ArgError -
522521
Modules/_cursesmodule.c - PyCursesError -
523522
Modules/_decimal/_decimal.c - DecimalException -
@@ -528,15 +527,15 @@ Modules/socketmodule.c - socket_gaierror -
528527
Modules/xxlimited_35.c - ErrorObject -
529528
Modules/xxmodule.c - ErrorObject -
530529

531-
#-----------------------
532-
# cached - initialized once
530+
##-----------------------
531+
## cached - initialized once
533532

534-
# manually cached PyUnicodeOjbect
533+
## manually cached PyUnicodeOjbect
535534
Modules/_asynciomodule.c - context_kwname -
536535
Modules/_ctypes/callproc.c _ctypes_get_errobj error_object_name -
537536
Modules/_ctypes/_ctypes.c CreateSwappedType suffix -
538537

539-
# other - during module init
538+
## other - during module init
540539
Modules/_asynciomodule.c - asyncio_mod -
541540
Modules/_asynciomodule.c - traceback_extract_stack -
542541
Modules/_asynciomodule.c - asyncio_future_repr_func -
@@ -551,10 +550,10 @@ Modules/_zoneinfo.c - io_open -
551550
Modules/_zoneinfo.c - _tzpath_find_tzfile -
552551
Modules/_zoneinfo.c - _common_mod -
553552

554-
#-----------------------
555-
# other
553+
##-----------------------
554+
## other
556555

557-
# initialized once
556+
## initialized once
558557
Modules/_ctypes/_ctypes.c - _unpickle -
559558
Modules/_ctypes/_ctypes.c PyCArrayType_from_ctype cache -
560559
Modules/_cursesmodule.c - ModDict -
@@ -577,7 +576,7 @@ Modules/_decimal/_decimal.c - Rational -
577576
Modules/_decimal/_decimal.c - SignalTuple -
578577
Modules/arraymodule.c array_array___reduce_ex___impl array_reconstructor -
579578

580-
# state
579+
## state
581580
Modules/_asynciomodule.c - cached_running_holder -
582581
Modules/_asynciomodule.c - fi_freelist -
583582
Modules/_asynciomodule.c - fi_freelist_len -
@@ -592,20 +591,19 @@ Modules/_tkinter.c - valInCmd -
592591
Modules/_tkinter.c - trbInCmd -
593592
Modules/_zoneinfo.c - TIMEDELTA_CACHE -
594593
Modules/_zoneinfo.c - ZONEINFO_WEAK_CACHE -
595-
Modules/syslogmodule.c - S_ident_o -
596594

597595

598596
##################################
599-
# global non-objects to fix in extension modules
597+
## global non-objects to fix in extension modules
600598

601-
#-----------------------
602-
# initialized once
599+
##-----------------------
600+
## initialized once
603601

604-
# pre-allocated buffer
602+
## pre-allocated buffer
605603
Modules/nismodule.c nisproc_maplist_2 res -
606604
Modules/pyexpat.c PyUnknownEncodingHandler template_buffer -
607605

608-
# other
606+
## other
609607
Include/datetime.h - PyDateTimeAPI -
610608
Modules/_asynciomodule.c - module_initialized -
611609
Modules/_ctypes/cfield.c _ctypes_get_fielddesc initialized -
@@ -650,8 +648,8 @@ Modules/readline.c - libedit_history_start -
650648
Modules/socketmodule.c - accept4_works -
651649
Modules/socketmodule.c - sock_cloexec_works -
652650

653-
#-----------------------
654-
# state
651+
##-----------------------
652+
## state
655653

656654
Modules/_asynciomodule.c - cached_running_holder_tsid -
657655
Modules/_asynciomodule.c - task_name_counter -
@@ -681,4 +679,3 @@ Modules/readline.c - completed_input_string -
681679
Modules/rotatingtree.c - random_stream -
682680
Modules/rotatingtree.c - random_value -
683681
Modules/socketmodule.c - defaulttimeout -
684-
Modules/syslogmodule.c - S_log_open -

0 commit comments

Comments
 (0)