FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-43690: stable_abi.py no longer parses macros by vstinner · Pull Request #25136 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .dat  (1) .py  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 0 additions & 1 deletion Doc/data/stable_abi.dat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ PyType_GetFlags
PyType_GetModule
PyType_GetModuleState
PyType_GetSlot
PyType_HasFeature
PyType_IsSubtype
PyType_Modified
PyType_Ready
Expand Down
33 changes: 1 addition & 32 deletions Tools/scripts/stable_abi.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand Down

Back | FazBrowse Home | New Git URL