Starting to support pypy3.11, need guidance for a cfg
stanza
#4755
-
Over at a binary build repo I am trying out PyPy3.11 (PyPy with python3.11) on a branch off my fork of PyO3. I changed the C interface for pyo3/pyo3-ffi/src/abstract_.rs Lines 12 to 15 in 6ec499b |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
We define our cfgs so that So to get "compiling for PyPy with at least a 3.11 interpreter", you can use So for this full clause, you'd want to change it to something like #[cfg(
all(
not(Py_3_13), // CPython exposed as a function in 3.13, in object.h
not(all(PyPy, not(Py_3_11))) // PyPy exposed as a function until PyPy 3.10, used macro in 3.11+
)
)]
pub unsafe fn PyObject_DelAttr(o: *mut PyObject, attr_name: *mut PyObject) -> c_int {
PyObject_SetAttr(o, attr_name, std::ptr::null_mut())
} ... amusing that CPython went the other direction in 3.13. I guess eventually when PyPy supports 3.13 you'll do similar and revert to the existing function form, to keep in sync with CPython? |
Beta Was this translation helpful? Give feedback.
-
Great, and thanks for the other hints. |
Beta Was this translation helpful? Give feedback.
We define our cfgs so that
Py_3_11
will be set for Python versions 3.11 and up, which will include PyPy if we detect that version.So to get "compiling for PyPy with at least a 3.11 interpreter", you can use
cfg(all(PyPy, Py_3_11))
.So for this full clause, you'd want to change it to something like
... amusing that CPython went the other dir…