-
Notifications
You must be signed in to change notification settings - Fork 6
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
Hard to reason about which functions are or are not part of the stable ABI #50
Comments
Define Contents of the limited API are listed here: https://pypi.org/project/abi3info/ As for C headers, I don't think they're a good source format for information about API. You'd need several of them (as you propose), and they can only be parsed by a C compiler (unless you use some well-defined subset of C). See #7 for a more general issue. |
@encukou Thanks for the note about Py_LIMITED_API, I agree it's very powerful and forgot about it. I also take your point in #7 about a manifest. Maybe the set of entry points are generated from a set of abi manifests (or alternativey the set of stable ABI functions are defined to point to a namespaced symbol in libpython.so) In the latter case, if libpython.so exports the function PyObject_New_ABI2 then if the user includes the line: #define PY_ABI_VERSION 2 before including the C header(s), PyObject_New is defined as an alias to PyObject_New_ABI2 rather than the exported symbol PyObject_New. I think my point is less about headers but more about where to house an alternative ABI that the python library actually exports, and additional headers was the first thing that came to mind from the developer experience point of view. |
You are explaining a solution. Could you focus more on identifying the problem that needs solving? Your example is about a change that changes ABI but keeps the same API (including behaviour). That's pretty rare, but, what you propose is possible, and used, today. (Just recently, the implementation of As for “marking” the module with an ABI tag, we already did that:
The fact that we used to do it but it kinda fell by the wayside suggests that we don't need it. |
Functions are added to the stable ABI over time, and just given the C definition of a module, auditing to see what function calls are stable and what aren't is not trivial.
I think the core issue is that there is only one header that all functions are supposed to be defined in, which is Python.h
I think the stable ABI could be defined in another header, PythonABI.h,
where Python.h includes PythonABI.h for compatibility reasons.
Taking this further, we can have a PythonABI1.h, PythonABI2.h, PythonABI3.h, etc, and Python.h includes the latest one, while modules that want to target a specific ABI with long-term guarantees can directly pick one of these.
Now, to make sure you only use the stable ABI, or which stable ABI, you need only look at the include block at the top of the module.
I'm not sure how feasible this is, but I think it is worth doing.
The text was updated successfully, but these errors were encountered: