/
githubmirror
/
cpython
ОбзорДокументацияВойти
/
githubmirror
/
cpython
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
ДокументацияПоддержка
Политика конфиденциальностиПользовательское соглашениеПолитика использования «cookies»Согласие субъекта персональных данных
2026 ©
cpython/
Tools/c-analyzer/
..
c_analyzer

clearer error and suggestion when c-analyzer cannot read ignored.tsv (#129423)

2 года назад
c_common

gh-155358: Use named attributes with pwd and grp modules (#155362)

8 часов назад
c_parser

gh-151428: Remove unused imports from `Tools/` (#151442)

2 месяца назад
cpython

gh-155266: Fix Argument Clinic for a lone optional group (GH-155267)

5 дней назад
distutils

gh-155358: Use named attributes with os module (#155366)

8 часов назад
README

gh-116265: Remove obsolete sentence. (#116284)

2 года назад
TODO

gh-132661: Implement PEP 750 (#132662)

год назад
c-analyzer.py

bpo-36876: Fix the C analyzer tool. (GH-22841)

6 лет назад
check-c-globals.py

gh-90110: Get the C Analyzer Tool Working Again (gh-95545)

4 года назад
must-resolve.sh

bpo-36876: [c-analyzer tool] Additional CLI updates for "capi" command. (gh-23929)

6 лет назад
table-file.py

gh-90110: Clean Up the C-analyzer Globals Lists (gh-100091)

4 года назад
README
#######################################
# C Globals and CPython Runtime State.
 
CPython's C code makes extensive use of global variables. Each global
falls into one of several categories:
 
* (effectively) constants (incl. static types)
* globals used exclusively in main or in the REPL
* freelists, caches, and counters
* process-global state
* module state
* Python runtime state
 
Of the different categories, the last two are problematic and
generally should not exist in the codebase.
 
Globals that hold module state (i.e. in Modules/*.c) cause problems
when multiple interpreters are in use. For more info, see PEP 3121,
which addresses the situation for extension modules in general.
 
Globals in the last category should be avoided as well. The problem
isn't with the Python runtime having state. Rather, the problem is with
that state being spread throughout the codebase in dozens of individual
globals. Unlike the other globals, the runtime state represents a set
of values that are constantly shifting in a complex way. When they are
spread out it's harder to get a clear picture of what the runtime
involves. Furthermore, when they are spread out it complicates efforts
that change the runtime.
 
Consequently, the globals for Python's runtime state have been
consolidated under a single top-level _PyRuntime global. No new globals
should be added for runtime state. Instead, they should be added to
_PyRuntimeState or one of its sub-structs. The check-c-globals script
should be run to ensure that no new globals have been added:
 
python3 Tools/c-analyzer/check-c-globals.py
 
You can also use the more generic tool:
 
python3 Tools/c-analyzer/c-analyzer.py
 
If it reports any globals then they should be resolved. If the globals
are runtime state then they should be folded into _PyRuntimeState.