10000 bpo-45952: Get the C analyzer tool working again. by ericsnowcurrently · Pull Request #29882 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-45952: Get the C analyzer tool working again. #29882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjust the default max size.
  • Loading branch information
ericsnowcurrently committed Nov 30, 2021
commit 1ea3b50b4fc96d4bd4dbb7ac877762439383c943
2 changes: 1 addition & 1 deletion Tools/c-analyzer/c_parser/parser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def _parse(srclines, anon_name, **srckwargs):
# We use defaults that cover most files. Files with bigger declarations
# are covered elsewhere (MAX_SIZES in cpython/_parser.py).

def _iter_source(lines, *, maxtext=20_000, maxlines=700, showtext=False):
def _iter_source(lines, *, maxtext=10_000, maxlines=200, showtext=False):
maxtext = maxtext if maxtext and maxtext > 0 else None
maxlines = maxlines if maxlines and maxlines > 0 else None
filestack = []
Expand Down
19 changes: 16 additions & 3 deletions Tools/c-analyzer/cpython/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,31 @@ def clean_lines(text):

# Windows
Modules/_winapi.c # windows.h
Modules/expat/winconfig.h
Modules/overlapped.c # winsock.h
Python/dynload_win.c # windows.h
Modules/expat/winconfig.h
Python/thread_nt.h

# other OS-dependent
Python/dynload_aix.c # sys/ldr.h
Python/dynload_dl.c # dl.h
Python/dynload_hpux.c # dl.h
Python/dynload_aix.c # sys/ldr.h
Python/thread_pthread.h

# only huge constants (safe but parsing is slow)
Modules/_blake2/impl/blake2-kat.h
Modules/_ssl_data.h
Modules/cjkcodecs/mappings_*.h
Modules/unicodedata_db.h
Modules/unicodename_db.h
Modules/cjkcodecs/mappings_*.h
Objects/unicodetype_db.h

# generated
Python/importlib.h
Python/importlib_external.h
Python/importlib_zipimport.h
Python/opcode_targets.h
Python/stdlib_module_names.h

# @end=conf@
''')
Expand Down Expand Up @@ -270,6 +275,14 @@ def clean_lines(text):
]

MAX_SIZES = {
_abs('Include/**/*.h'): (5_000, 500),
_abs('Modules/_ctypes/ctypes.h'): (5_000, 500),
_abs('Modules/_datetimemodule.c'): (20_000, 300),
_abs('Modules/posixmodule.c'): (20_000, 500),
_abs('Modules/termios.c'): (10_000, 800),
_abs('Modules/_testcapimodule.c'): (20_000, 400),
_abs('Modules/expat/expat.h'): (10_000, 400),
_abs('Objects/typeobject.c'): (20_000, 200),
}


Expand Down
0