ericsnowcurrently / multi-core-python

Enabling CPython multi-core parallelism via subinterpreters.
BSD 3-Clause "New" or "Revised" License
245 stars 6 forks source link

Non-critical deficiencies in `Tools/c-globals/c-globals.py`. #49

Open ericsnowcurrently opened 5 years ago

ericsnowcurrently commented 5 years ago

(see #33) (blocked by #47)

In #47 we are addressing critical deficiencies in the check-c-globals.py (and adding c-globals.py). Here we are focusing on nice-to-haves for c-globals.py (at the least identifying them). While they are not the focus of #47, some of them might be partially addressed there.

Here are some non-critical deficiencies:

... \ ...


(Everything past here is just dumped WIP text...)

Directory structure:

Tools/c-analyzer/
    c_statics/
        README (including "Resolving Failures" section)
        __main__.py
        find.py
        show.py
        known.py
        supported.py
        ignored.tsv (temporary)
    c_parser/
        files.py
        info.py
        statics.py
        declarations.py
        (pycparser / ply)  <--------------- new
    c_symbols/  <--------------- new
        symbols.py (wrapper around "nm" command, etc.)
    c-statics.py
    check-c-statics.py
Lib/test/
    test_tools/test_tool_c_analyzer/
        testdata/...
        test_c_statics/...
        test_c_parser/...
        test_c_symbols/...  <--------------- new
    test_check_c_statics.py

TODO:

Formatting:

Here are things we can do later:


bpo-36876: "Global C variables are a problem."

1. update check-c-globals.py to identify static locals (and thread-locals)
2. deal with any identified globals
   * move them to _PyRuntimeState (or thread-locals to PyThreadState, etc.)
   * ignore them by adding them to Tools/c-globals/ignored-globals.txt
3. add check-c-globals.py to "make check"
4. (if "make check" isn't already there), ensure check-c-globals.py is run at
    some point in CI
...
Also, Tools/c-globals/ignored-globals.txt is a bit out of date (some vars have
been removed, renamed, or moved to another file).  That should get cleaned
up.  It might also make sense to update check-c-globals.py to verify that all
variables in ignored-globals.txt actually exist.