diff options
author | Victor Stinner <vstinner@python.org> | 2021-04-01 12:13:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-01 12:13:42 (GMT) |
commit | 61092a99c4840f36dbde8457cb566fc3c012930f (patch) | |
tree | 9e3998cd170d987c990bbcf53c689047e771dd5a /Tools | |
parent | baf10da75072d1f8ec714d3c2c8550d34db343a9 (diff) | |
download | cpython-61092a99c4840f36dbde8457cb566fc3c012930f.zip cpython-61092a99c4840f36dbde8457cb566fc3c012930f.tar.gz cpython-61092a99c4840f36dbde8457cb566fc3c012930f.tar.bz2 |
bpo-43690: stable_abi.py no longer parses macros (GH-25136)
The stable_abi.py script no longer parse macros. Macro targets can be
static inline functions which are not part of the stable ABI, only
part of the limited C API.
Run "make regen-limited-abi" to exclude PyType_HasFeature from
Doc/data/stable_abi.dat.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/stable_abi.py | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/Tools/scripts/stable_abi.py b/Tools/scripts/stable_abi.py index 0f9e365..14fcf2f 100755 --- a/Tools/scripts/stable_abi.py +++ b/Tools/scripts/stable_abi.py @@ -112,11 +112,10 @@ def generate_limited_api_symbols(args): stable_data, stable_exported_data, stable_functions = get_limited_api_definitions( headers ) - macros = get_limited_api_macros(headers) stable_symbols = { symbol - for symbol in (stable_functions | stable_exported_data | stable_data | macros) + for symbol in (stable_functions | stable_exported_data | stable_data) if symbol.startswith("Py") and symbol in available_symbols } with open(args.output_file, "w") as output_file: @@ -128,36 +127,6 @@ def generate_limited_api_symbols(args): output_file.write(f"{symbol}\n") -def get_limited_api_macros(headers): - """Run the preprocesor over all the header files in "Include" setting - "-DPy_LIMITED_API" to the correct value for the running version of the interpreter - and extracting all macro definitions (via adding -dM to the compiler arguments). - """ - - preprocesor_output_with_macros = subprocess.check_output( - sysconfig.get_config_var("CC").split() - + [ - # Prevent the expansion of the exported macros so we can capture them later - "-DSIZEOF_WCHAR_T=4", # The actual value is not important - f"-DPy_LIMITED_API={sys.version_info.major << 24 | sys.version_info.minor << 16}", - "-I.", - "-I./Include", - "-dM", - "-E", - ] - + [str(file) for file in headers], - text=True, - stderr=subprocess.DEVNULL, - ) - - return { - target - for _, target in re.findall( - r"#define (\w+)\s*(?:\(.*?\))?\s+(\w+)", preprocesor_output_with_macros - ) - } - - def get_limited_api_definitions(headers): """Run the preprocesor over all the header files in "Include" setting "-DPy_LIMITED_API" to the correct value for the running version of the interpreter. |