Skip to content
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

mangle exported functions for PyPy #3031

Merged
merged 2 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/3031.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mangle exported function names for PyPy
2 changes: 2 additions & 0 deletions pyo3-ffi/src/abstract_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extern "C" {
not(PyPy),
any(Py_3_10, all(not(Py_LIMITED_API), Py_3_9)) // Added to python in 3.9 but to limited API in 3.10
))]
#[cfg_attr(PyPy, link_name = "PyPyObject_CallNoArgs")]
pub fn PyObject_CallNoArgs(func: *mut PyObject) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyObject_Call")]
pub fn PyObject_Call(
Expand Down Expand Up @@ -113,6 +114,7 @@ extern "C" {
#[cfg_attr(PyPy, link_name = "PyPyIter_Next")]
pub fn PyIter_Next(arg1: *mut PyObject) -> *mut PyObject;
#[cfg(all(not(PyPy), Py_3_10))]
#[cfg_attr(PyPy, link_name = "PyPyIter_Send")]
pub fn PyIter_Send(iter: *mut PyObject, arg: *mut PyObject, presult: *mut *mut PyObject);

#[cfg_attr(PyPy, link_name = "PyPyNumber_Check")]
Expand Down
1 change: 1 addition & 0 deletions pyo3-ffi/src/modsupport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern "C" {
// skipped non-limited _PyArg_Fini

#[cfg(Py_3_10)]
#[cfg_attr(PyPy, link_name = "PyPyModule_AddObjectRef")]
pub fn PyModule_AddObjectRef(
module: *mut PyObject,
name: *const c_char,
Expand Down
3 changes: 3 additions & 0 deletions pyo3-ffi/src/objimpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,15 @@ extern "C" {
pub fn PyGC_Collect() -> Py_ssize_t;

#[cfg(Py_3_10)]
#[cfg_attr(PyPy, link_name = "PyPyGC_Enable")]
pub fn PyGC_Enable() -> c_int;

#[cfg(Py_3_10)]
#[cfg_attr(PyPy, link_name = "PyPyGC_Disable")]
pub fn PyGC_Disable() -> c_int;

#[cfg(Py_3_10)]
#[cfg_attr(PyPy, link_name = "PyPyGC_IsEnabled")]
pub fn PyGC_IsEnabled() -> c_int;
}

Expand Down
5 changes: 5 additions & 0 deletions pyo3-ffi/src/pyerrors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ extern "C" {
#[cfg_attr(PyPy, link_name = "PyPyExc_ResourceWarning")]
pub static mut PyExc_ResourceWarning: *mut PyObject;
#[cfg(Py_3_10)]
#[cfg_attr(PyPy, link_name = "PyPyExc_EncodingWarning")]
pub static mut PyExc_EncodingWarning: *mut PyObject;
}

Expand Down Expand Up @@ -305,9 +306,13 @@ extern "C" {
#[cfg_attr(PyPy, link_name = "PyPyErr_SetInterrupt")]
pub fn PyErr_SetInterrupt();
#[cfg(Py_3_10)]
#[cfg_attr(PyPy, link_name = "PyPyErr_SetInterruptEx")]
pub fn PyErr_SetInterruptEx(signum: c_int);
#[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocation")]
pub fn PyErr_SyntaxLocation(filename: *const c_char, lineno: c_int);
#[cfg_attr(PyPy, link_name = "PyPyErr_SyntaxLocationEx")]
pub fn PyErr_SyntaxLocationEx(filename: *const c_char, lineno: c_int, col_offset: c_int);
#[cfg_attr(PyPy, link_name = "PyPyErr_ProgramText")]
pub fn PyErr_ProgramText(filename: *const c_char, lineno: c_int) -> *mut PyObject;
#[cfg(not(PyPy))]
pub fn PyUnicodeDecodeError_Create(
Expand Down