diff options
Diffstat (limited to 'Tools/build/smelly.py')
-rwxr-xr-x | Tools/build/smelly.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Tools/build/smelly.py b/Tools/build/smelly.py index ab34530..7c53426 100755 --- a/Tools/build/smelly.py +++ b/Tools/build/smelly.py @@ -11,6 +11,11 @@ ALLOWED_PREFIXES = ('Py', '_Py') if sys.platform == 'darwin': ALLOWED_PREFIXES += ('__Py',) +# mimalloc doesn't use static, but it's symbols are not exported +# from the shared library. They do show up in the static library +# before its linked into an executable. +ALLOWED_STATIC_PREFIXES = ('mi_', '_mi_') + # "Legacy": some old symbols are prefixed by "PY_". EXCEPTIONS = frozenset({ 'PY_TIMEOUT_MAX', @@ -59,7 +64,7 @@ def get_exported_symbols(library, dynamic=False): return stdout -def get_smelly_symbols(stdout): +def get_smelly_symbols(stdout, dynamic=False): smelly_symbols = [] python_symbols = [] local_symbols = [] @@ -77,7 +82,9 @@ def get_smelly_symbols(stdout): symbol = parts[-1] result = '%s (type: %s)' % (symbol, symtype) - if symbol.startswith(ALLOWED_PREFIXES) or symbol in EXCEPTIONS: + if (symbol.startswith(ALLOWED_PREFIXES) or + symbol in EXCEPTIONS or + (not dynamic and symbol.startswith(ALLOWED_STATIC_PREFIXES))): python_symbols.append(result) continue @@ -95,7 +102,7 @@ def get_smelly_symbols(stdout): def check_library(library, dynamic=False): nm_output = get_exported_symbols(library, dynamic) - smelly_symbols, python_symbols = get_smelly_symbols(nm_output) + smelly_symbols, python_symbols = get_smelly_symbols(nm_output, dynamic) if not smelly_symbols: print(f"OK: no smelly symbol found ({len(python_symbols)} Python symbols)") |