-
Notifications
You must be signed in to change notification settings - Fork 1
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
Expose ABI information outside headers #19
Comments
This looks like a combination of tooling and guidelines; ideally the tooling would enforce (this aspect of) the guidelines. My understanding is that the tooling would read and parse (some of) the header files, being careful not to require the C preprocessor. Someone should probably create a prototype of the tooling and see how much the header files would need to change in order to support everything that's in the headers. If we can't get anyone to work on tooling this probably isn't actionable. (UPDATE: We have a pretty decent C tokenizer written in Python, in |
There's also a C pre-processor parser in Argument Clinic, FWIW: |
There's currently some work going on to define a not-quite-sysconfig.json file to include with each build of Python, so that it's possible to determine build commands/options/paths without having to actually run Python (crucial for cross-compiling; convenient for other reasons). We can probably put this file in the same place, wherever it ends up being. python/cpython#107956 |
I have started spec-ing out a static file (JSON) to be shipped with Python installations, which could include the information here. @encukou would you be available to collaborate on defining the API and ABI sections? |
@FFY00 you might be interested in this script which PyO3 uses to query the Python interpreter to configure Rust extension builds: If there's a static JSON file which we could locate to get the same information, this would be particularly helpful in cross-compile situations where we currently resort to different fallbacks. We could also potentially consume the ABI information proposed here at the same time. |
Thanks!
Yes, this is one of the main target use-cases of the proposal. |
Yes, next week or so. |
Looking at it more closely, the static description file is something different than what I propose in this issue. The description file will need info like:
And so on. For a low-effort, *nix-specifix first approximation, you want the info exposed by click to expand
This issue asks for info like:
(Again: |
Yes, I linked the two together because of the similarities of distributing a standalone file that has to live in a directory that is somehow discoverable by tools that cannot launch the runtime. I always expected two separate files, I just hoped that they could be next to each other and not in totally unrelated locations :) |
For non-C languages, it would be great to expose information in a way that doesn't require a C preprocessor/compiler. It should be a Python dict in some module. (Or even a JSON file distributed with each build of Python -- but if code to locate that might be too complex.)
We definitely need:
#define
d constants (e.g. slot IDs, feature flags, bitfield masks)We might want to add:
(These could live in
ctypes.pythonapi
, to make sure itsstruct
support is correct.)See non-C language document.
(PyPy is fine with headers, as they already went through the trouble of writing a C parser & FFI.)
The text was updated successfully, but these errors were encountered: