Critical deficiencies in Tools/c-globals/check-c-globals.py
.
#47
Labels
complexity: medium
moderately hard to figure out
P0
high priority
size: medium
requires a moderate amount of changes
type: code health
URGENT
must be dealt with ASAP
X [isolation]
improved interpreter isolation
X [runtime]
CPython runtime (lifecycle, state)
(see #33)
The existing
Tools/c-globals/check-c-globals.py
script is an important tool for achieving a per-interpreter GIL (and generally for the health of the CPython code base). However, it has a number of problems that keep it from being helpful in reaching that objective.First we'll review the characteristics of the tool. Then we'll look at the deficiencies. Finally, we'll cover the specific tasks that will address those problems.
Purpose
The script has the following 2 core purposes:
(More or less, "unsupported" means the variable holds per-interpreter runtime state.)
Constraints
The script also has the following core constraints:
Deficiencies
In context of those purposes and constraints, the script has some critical deficiencies (in rough order of priority):
nm
on linux)(Note that non-critical deficiencies (and nice-to-haves) are covered in #49.)
Solution
(Reminder: we're only aiming to addresss critical deficiencies here.)
High-level Plan
Tools/c-globals
toTools/c-analyzer
c-statics.py
check-c-statics.py
check-c-globals.py
as a single-purpose script namedcheck-c-statics.py
c-statics.py
(i.e. callTools/c-analyzer/c_statics/__main__.py:main()
)c-statics.py
script in outputTools/c-analyzer/c_statics/ignored.tsv
--ignore
option to thec-statics.py
scriptLib/test/test_check_c_statics.py
check-c-statics.py
scriptignored.tsv
for now (will still catch any new statics)At that point we can use the tool sans nearly all deficiencies. The remaining tasks would then be:
Tools/c-analyzer/c-statics.py
using other tools. #50) validatec-statics.py
script results independentlyTools/c-globals/check-c-statics.py
should pass without any ignored globals. #48) resolve all remaining unsupported staticsTools/c-globals/c-globals.py
. #49) address non-critical deficienciesDirectory Structure
c-statics.py CLI
The
c-statics.py
script will initially have the following basic CLI:show [--ignored FILE] [--known FILE] [DIR,...]
check [--ignored FILE] [--known FILE] [DIR,...]
Specific Tasks for
c-globals.py
(Each task includes adding sufficient tests.)
Tools/c-globals/_cg/
: add__init__.py
Lib/test/test_toolcglobals.py
: frame out the tests_cg/__main__.py
: add a basicparse_args()
,main()
, andif __name__ == '__main__
:`__main__.py
: stub out a "show" command w/ file args__main__.py
: stub out a "check" command w/ file argsTools/c-globals/c-globals.py
: copyif __name__ == '__main__
:from
_cg/main.py`info.py
: addStaticVar
(filename, funcname, name, vartype)find.py
: add a fake "statics()" func (w/ hard-coded [StaticVar, supported] list)show.py
: addshow_basic()
(group by supported / unsupported)__main__.py
: implement the "show" command__main__.py
: implement the "check" commandscan.py
: add "iter_statics(file)" with a fake list ofStaticVar
supported.py
: add "is_supported(var)" with a simple testable heuristicfind.py
: implement "statics()"scan.py
: add "normalize_vartype(text)"scan.py
: implement "iter_statics()"known.py
: add "self_check()"Lib/test/test_toolcglobals.py
: add black-box system tests forc-globals.py
(see below)Lib/test/test_toolcglobals.py
: add a "self-check" system testSystem Tests
nm
outputc-globals.py show
against dummy filesc-globals.py check
against dummy files:dummy files:
The text was updated successfully, but these errors were encountered: