Skip to content

Commit

Permalink
Merge #2811
Browse files Browse the repository at this point in the history
2811: adjust vectorcall symbols for pypy r=davidhewitt a=davidhewitt

Closes #2738

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
  • Loading branch information
bors[bot] and davidhewitt authored Dec 17, 2022
2 parents 239f8e6 + 97d6432 commit 12f3cf3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/2811.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add FFI definitions `PyVectorcall_NARGS` and `PY_VECTORCALL_ARGUMENTS_OFFSET` for PyPy 3.8 and up.
1 change: 1 addition & 0 deletions newsfragments/2811.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix unresolved symbol for `PyObject_Vectorcall` on PyPy 3.9 and up.
5 changes: 3 additions & 2 deletions pyo3-ffi/src/cpython/abstract_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ extern "C" {
) -> *mut PyObject;
}

#[cfg(all(Py_3_8, not(PyPy)))]
#[cfg(all(Py_3_8))]
const PY_VECTORCALL_ARGUMENTS_OFFSET: Py_ssize_t =
1 << (8 * std::mem::size_of::<Py_ssize_t>() as Py_ssize_t - 1);

#[cfg(all(Py_3_8, not(PyPy)))]
#[cfg(all(Py_3_8))]
#[inline(always)]
pub unsafe fn PyVectorcall_NARGS(n: size_t) -> Py_ssize_t {
assert!(n <= (PY_SSIZE_T_MAX as size_t));
Expand Down Expand Up @@ -103,6 +103,7 @@ pub unsafe fn PyObject_Vectorcall(
extern "C" {
#[cfg(all(PyPy, Py_3_8))]
#[cfg_attr(not(Py_3_9), link_name = "_PyPyObject_Vectorcall")]
#[cfg_attr(Py_3_9, link_name = "PyPyObject_Vectorcall")]
pub fn PyObject_Vectorcall(
callable: *mut PyObject,
args: *const *mut PyObject,
Expand Down

0 comments on commit 12f3cf3

Please sign in to comment.