-
Notifications
You must be signed in to change notification settings - Fork 940
Description
After #5753 is merged, it should be possible to experiment with the opaque PyObject ABI. I don't think we should merge this code into PyO3 (yet) but I think it's important to work through this exercise to enable end-to-end testing of PEP 803. My end goal is to build a abi3t wheel for cryptography by using the experimental private support in CPython for opaque PyObject via _Py_OPAQUE_PYOBJECT.
I'm planning to work on this but if anyone else wants to help out just let me know.
First, I'll need to expose _Py_OPAQUE_PYOBJECT in pyo3-build-config in a manner analogous to Py_GIL_DISABLED and Py_LIMITED_API.
After that, I'll need to update the FFI bindings to no longer assume that Py_LIMITED_API implies not(Py_GIL_DISABLED), which probably means updating some conditional compilation. I'll also need to update a few definitions for structs to match the CPython headers when _Py_OPAQUE_PYOBJECT is defined.
Finally, I'll need to update anywhere in PyO3 itself where we assume Py_LIMITED_API implies not(Py_GIL_DISABLED) or somehow relies on the layout of PyObject. Since PyO3 uses heap types and (after #5753) PEP 793 module initialization, I don't think it's necessary to update to use different C APIs or anything like that.
At that point, I should be able to actually build a limited API extension on the free-threaded build.
To get to the point where we can build limited API wheels, we might need to update code in maturin and setuptools-rust.