Skip to content
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/6389.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix many unresolved symbols when linking for PyPy due to incorrect link names in `pyo3-ffi`.
47 changes: 17 additions & 30 deletions pyo3-ffi-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{ffi::CStr, process::exit};
use pyo3_ffi_check_definitions::{bindgen as bindings, pyo3_ffi};

/// Functions which don't have equivalent addresses between pyo3-ffi and bindgen.
#[cfg(not(PyPy))]
static SPECIAL_CASE_FUNCTIONS: &[&str] = &[
"PyEval_RestoreThread", // PyO3 adds special handling for pthread_exit
"PyGILState_Ensure", // Similar to PyEval_RestoreThread
Expand Down Expand Up @@ -150,36 +149,24 @@ fn main() {
// Typically `name` == `bindgen_name`, but e.g. for PyPy this is not the case.
macro_rules! check_function {
($name:ident, $bindgen_name:ident, [$($modifiers:tt)*] ($($arg_types:tt)*)) => {{

#[cfg(not(PyPy))]
{
// Check functions have the same number of arguments
#[allow(deprecated)]
let pyo3_ffi_fn = { pyo3_ffi::$name as $($modifiers)* fn($($arg_types)*) -> _ };
let bindgen_fn = bindings::$bindgen_name as $($modifiers)* fn($($arg_types)*) -> _;

// Check function addresses are the same (i.e. link is configured as expected).
// This will also trigger build errors if linker fails to find the symbol pyo3-ffi
// is expecting.
if !std::ptr::fn_addr_eq(pyo3_ffi_fn, bindgen_fn)
&& !SPECIAL_CASE_FUNCTIONS.contains(&stringify!($name))
{
failed = true;
println!(
"error: function address of {} differs between pyo3_ffi ({:p}) and bindgen ({:p})",
stringify!($name),
pyo3_ffi_fn,
bindgen_fn
);
}
}

#[cfg(PyPy)] // FIXME https://github.com/PyO3/pyo3/pull/6389
// Check functions have the same number of arguments
#[allow(deprecated)]
let pyo3_ffi_fn = { pyo3_ffi::$name as $($modifiers)* fn($($arg_types)*) -> _ };
let bindgen_fn = bindings::$bindgen_name as $($modifiers)* fn($($arg_types)*) -> _;

// Check function addresses are the same (i.e. link is configured as expected).
// This will also trigger build errors if linker fails to find the symbol pyo3-ffi
// is expecting.
if !std::ptr::fn_addr_eq(pyo3_ffi_fn, bindgen_fn)
&& !SPECIAL_CASE_FUNCTIONS.contains(&stringify!($name))
{
// Check functions have the same number of arguments
#[allow(deprecated)]
{ pyo3_ffi::$name as $($modifiers)* fn($($arg_types)*) -> _ };
bindings::$bindgen_name as $($modifiers)* fn($($arg_types)*) -> _;
failed = true;
println!(
"error: function address of {} differs between pyo3_ffi ({:p}) and bindgen ({:p})",
stringify!($name),
pyo3_ffi_fn,
bindgen_fn
);
}

// TODO: can probably sniff arg types by binding sniffers for each argument position and then passing
Expand Down
192 changes: 98 additions & 94 deletions pyo3-ffi/src/abstract_.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyo3-ffi/src/boolobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ pub unsafe fn Py_IsFalse(x: *mut PyObject) -> c_int {
// skipped Py_RETURN_FALSE

extern_libpython! {
#[cfg_attr(PyPy, link_name = "PyPyBool_FromLong")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBool_FromLong")]
pub fn PyBool_FromLong(arg1: c_long) -> *mut PyObject;
}
12 changes: 6 additions & 6 deletions pyo3-ffi/src/bytearrayobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ extern_libpython! {
#[cfg(RustPython)]
pub fn PyByteArray_CheckExact(op: *mut PyObject) -> c_int;

#[cfg_attr(PyPy, link_name = "PyPyByteArray_FromObject")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyByteArray_FromObject")]
pub fn PyByteArray_FromObject(o: *mut PyObject) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyByteArray_Concat")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyByteArray_Concat")]
pub fn PyByteArray_Concat(a: *mut PyObject, b: *mut PyObject) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyByteArray_FromStringAndSize")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyByteArray_FromStringAndSize")]
pub fn PyByteArray_FromStringAndSize(string: *const c_char, len: Py_ssize_t) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyByteArray_Size")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyByteArray_Size")]
pub fn PyByteArray_Size(bytearray: *mut PyObject) -> Py_ssize_t;
#[cfg_attr(PyPy, link_name = "PyPyByteArray_AsString")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyByteArray_AsString")]
pub fn PyByteArray_AsString(bytearray: *mut PyObject) -> *mut c_char;
#[cfg_attr(PyPy, link_name = "PyPyByteArray_Resize")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyByteArray_Resize")]
pub fn PyByteArray_Resize(bytearray: *mut PyObject, len: Py_ssize_t) -> c_int;
}
17 changes: 9 additions & 8 deletions pyo3-ffi/src/bytesobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,26 @@ extern_libpython! {
#[cfg(RustPython)]
pub fn PyBytes_CheckExact(op: *mut PyObject) -> c_int;

#[cfg_attr(PyPy, link_name = "PyPyBytes_FromStringAndSize")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_FromStringAndSize")]
pub fn PyBytes_FromStringAndSize(arg1: *const c_char, arg2: Py_ssize_t) -> *mut PyObject;
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_FromString")]
pub fn PyBytes_FromString(arg1: *const c_char) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyBytes_FromObject")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_FromObject")]
pub fn PyBytes_FromObject(arg1: *mut PyObject) -> *mut PyObject;
// skipped PyBytes_FromFormatV
//#[cfg_attr(PyPy, link_name = "PyPyBytes_FromFormatV")]
//pub fn PyBytes_FromFormatV(arg1: *const c_char, arg2: va_list)
// -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyBytes_FromFormat")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_FromFormat")]
pub fn PyBytes_FromFormat(arg1: *const c_char, ...) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyBytes_Size")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_Size")]
pub fn PyBytes_Size(arg1: *mut PyObject) -> Py_ssize_t;
#[cfg_attr(PyPy, link_name = "PyPyBytes_AsString")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_AsString")]
pub fn PyBytes_AsString(arg1: *mut PyObject) -> *mut c_char;
pub fn PyBytes_Repr(arg1: *mut PyObject, arg2: c_int) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyBytes_Concat")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_Concat")]
pub fn PyBytes_Concat(arg1: *mut *mut PyObject, arg2: *mut PyObject);
#[cfg_attr(PyPy, link_name = "PyPyBytes_ConcatAndDel")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_ConcatAndDel")]
pub fn PyBytes_ConcatAndDel(arg1: *mut *mut PyObject, arg2: *mut PyObject);
pub fn PyBytes_DecodeEscape(
arg1: *const c_char,
Expand All @@ -54,7 +55,7 @@ extern_libpython! {
arg4: Py_ssize_t,
arg5: *const c_char,
) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyBytes_AsStringAndSize")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBytes_AsStringAndSize")]
pub fn PyBytes_AsStringAndSize(
obj: *mut PyObject,
s: *mut *mut c_char,
Expand Down
50 changes: 25 additions & 25 deletions pyo3-ffi/src/ceval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::pytypedefs::PyThreadState;
use core::ffi::{c_char, c_int, c_void};

extern_libpython! {
#[cfg_attr(PyPy, link_name = "PyPyEval_EvalCode")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_EvalCode")]
pub fn PyEval_EvalCode(
arg1: *mut PyObject,
arg2: *mut PyObject,
Expand All @@ -26,7 +26,7 @@ extern_libpython! {

#[cfg(not(Py_3_13))]
#[deprecated(note = "Python 3.9")]
#[cfg_attr(PyPy, link_name = "PyPyEval_CallObjectWithKeywords")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_CallObjectWithKeywords")]
pub fn PyEval_CallObjectWithKeywords(
func: *mut PyObject,
obj: *mut PyObject,
Expand All @@ -45,24 +45,24 @@ pub unsafe fn PyEval_CallObject(func: *mut PyObject, arg: *mut PyObject) -> *mut
extern_libpython! {
#[cfg(not(Py_3_13))]
#[deprecated(note = "Python 3.9")]
#[cfg_attr(PyPy, link_name = "PyPyEval_CallFunction")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_CallFunction")]
pub fn PyEval_CallFunction(obj: *mut PyObject, format: *const c_char, ...) -> *mut PyObject;
#[cfg(not(Py_3_13))]
#[deprecated(note = "Python 3.9")]
#[cfg_attr(PyPy, link_name = "PyPyEval_CallMethod")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_CallMethod")]
pub fn PyEval_CallMethod(
obj: *mut PyObject,
methodname: *const c_char,
format: *const c_char,
...
) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyEval_GetBuiltins")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_GetBuiltins")]
pub fn PyEval_GetBuiltins() -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyEval_GetGlobals")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_GetGlobals")]
pub fn PyEval_GetGlobals() -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyEval_GetLocals")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_GetLocals")]
pub fn PyEval_GetLocals() -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyEval_GetFrame")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_GetFrame")]
pub fn PyEval_GetFrame() -> *mut crate::PyFrameObject;

#[cfg(Py_3_13)]
Expand All @@ -75,44 +75,44 @@ extern_libpython! {
#[cfg_attr(PyPy, link_name = "PyPyEval_GetFrameLocals")]
pub fn PyEval_GetFrameLocals() -> *mut PyObject;

#[cfg_attr(PyPy, link_name = "PyPy_AddPendingCall")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPy_AddPendingCall")]
pub fn Py_AddPendingCall(
func: Option<extern "C" fn(arg1: *mut c_void) -> c_int>,
arg: *mut c_void,
) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPy_MakePendingCalls")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPy_MakePendingCalls")]
pub fn Py_MakePendingCalls() -> c_int;

#[cfg_attr(PyPy, link_name = "PyPy_SetRecursionLimit")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPy_SetRecursionLimit")]
pub fn Py_SetRecursionLimit(arg1: c_int);
#[cfg_attr(PyPy, link_name = "PyPy_GetRecursionLimit")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPy_GetRecursionLimit")]
pub fn Py_GetRecursionLimit() -> c_int;

#[cfg_attr(PyPy, link_name = "PyPy_EnterRecursiveCall")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPy_EnterRecursiveCall")]
pub fn Py_EnterRecursiveCall(arg1: *const c_char) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPy_LeaveRecursiveCall")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPy_LeaveRecursiveCall")]
pub fn Py_LeaveRecursiveCall();

#[cfg_attr(PyPy, link_name = "PyPyEval_GetFuncName")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_GetFuncName")]
pub fn PyEval_GetFuncName(arg1: *mut PyObject) -> *const c_char;
#[cfg_attr(PyPy, link_name = "PyPyEval_GetFuncDesc")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_GetFuncDesc")]
pub fn PyEval_GetFuncDesc(arg1: *mut PyObject) -> *const c_char;

#[cfg_attr(PyPy, link_name = "PyPyEval_EvalFrame")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_EvalFrame")]
pub fn PyEval_EvalFrame(arg1: *mut crate::PyFrameObject) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyEval_EvalFrameEx")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_EvalFrameEx")]
pub fn PyEval_EvalFrameEx(f: *mut crate::PyFrameObject, exc: c_int) -> *mut PyObject;

#[cfg_attr(PyPy, link_name = "PyPyEval_SaveThread")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_SaveThread")]
pub fn PyEval_SaveThread() -> *mut PyThreadState;

#[cfg(not(Py_3_13))]
#[cfg_attr(PyPy, link_name = "PyPyEval_ThreadsInitialized")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_ThreadsInitialized")]
#[deprecated(
note = "Deprecated in Python 3.9, this function always returns true in Python 3.7 or newer."
)]
pub fn PyEval_ThreadsInitialized() -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyEval_InitThreads")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_InitThreads")]
#[deprecated(
note = "Deprecated in Python 3.9, this function does nothing in Python 3.7 or newer."
)]
Expand All @@ -123,9 +123,9 @@ extern_libpython! {
#[cfg(not(Py_3_13))]
#[deprecated(note = "Deprecated in Python 3.2")]
pub fn PyEval_ReleaseLock();
#[cfg_attr(PyPy, link_name = "PyPyEval_AcquireThread")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_AcquireThread")]
pub fn PyEval_AcquireThread(tstate: *mut PyThreadState);
#[cfg_attr(PyPy, link_name = "PyPyEval_ReleaseThread")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_ReleaseThread")]
pub fn PyEval_ReleaseThread(tstate: *mut PyThreadState);
}

Expand All @@ -139,14 +139,14 @@ extern_libpython! {
mod raw {
use crate::pytypedefs::PyThreadState;
extern_libpython! { "C-unwind" {
#[cfg_attr(PyPy, link_name = "PyPyEval_RestoreThread")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_RestoreThread")]
pub fn PyEval_RestoreThread(tstate: *mut PyThreadState);
}}
}

#[cfg(any(Py_3_14, target_arch = "wasm32"))]
extern_libpython! {
#[cfg_attr(PyPy, link_name = "PyPyEval_RestoreThread")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyEval_RestoreThread")]
pub fn PyEval_RestoreThread(tstate: *mut PyThreadState);
}

Expand Down
8 changes: 6 additions & 2 deletions pyo3-ffi/src/codecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ extern_libpython! {
// skipped non-limited _PyCodec_Lookup from Include/codecs.h
// skipped non-limited _PyCodec_Forget from Include/codecs.h
pub fn PyCodec_KnownEncoding(encoding: *const c_char) -> c_int;
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyCodec_Encode")]
pub fn PyCodec_Encode(
object: *mut PyObject,
encoding: *const c_char,
errors: *const c_char,
) -> *mut PyObject;
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyCodec_Decode")]
pub fn PyCodec_Decode(
object: *mut PyObject,
encoding: *const c_char,
Expand All @@ -24,14 +26,16 @@ extern_libpython! {
// skipped non-limited _PyCodec_DecodeText from Include/codecs.h
// skipped non-limited _PyCodecInfo_GetIncrementalDecoder from Include/codecs.h
// skipped non-limited _PyCodecInfo_GetIncrementalEncoder from Include/codecs.h
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyCodec_Encoder")]
pub fn PyCodec_Encoder(encoding: *const c_char) -> *mut PyObject;
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyCodec_Decoder")]
pub fn PyCodec_Decoder(encoding: *const c_char) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyCodec_IncrementalEncoder")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyCodec_IncrementalEncoder")]
pub fn PyCodec_IncrementalEncoder(
encoding: *const c_char,
errors: *const c_char,
) -> *mut PyObject;
#[cfg_attr(PyPy, link_name = "PyPyCodec_IncrementalDecoder")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyCodec_IncrementalDecoder")]
pub fn PyCodec_IncrementalDecoder(
encoding: *const c_char,
errors: *const c_char,
Expand Down
6 changes: 3 additions & 3 deletions pyo3-ffi/src/complexobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ extern_libpython! {
pub fn PyComplex_CheckExact(op: *mut PyObject) -> c_int;

// skipped non-limited PyComplex_FromCComplex
#[cfg_attr(PyPy, link_name = "PyPyComplex_FromDoubles")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyComplex_FromDoubles")]
pub fn PyComplex_FromDoubles(real: c_double, imag: c_double) -> *mut PyObject;

#[cfg_attr(PyPy, link_name = "PyPyComplex_RealAsDouble")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyComplex_RealAsDouble")]
pub fn PyComplex_RealAsDouble(op: *mut PyObject) -> c_double;
#[cfg_attr(PyPy, link_name = "PyPyComplex_ImagAsDouble")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyComplex_ImagAsDouble")]
pub fn PyComplex_ImagAsDouble(op: *mut PyObject) -> c_double;
}
16 changes: 8 additions & 8 deletions pyo3-ffi/src/cpython/abstract_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,31 +182,31 @@ extern_libpython! {

#[cfg(not(Py_3_11))] // moved to src/buffer.rs from 3.11
extern_libpython! {
#[cfg_attr(PyPy, link_name = "PyPyObject_GetBuffer")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyObject_GetBuffer")]
pub fn PyObject_GetBuffer(obj: *mut PyObject, view: *mut Py_buffer, flags: c_int) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyBuffer_GetPointer")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBuffer_GetPointer")]
pub fn PyBuffer_GetPointer(
view: *mut Py_buffer,
indices: *mut Py_ssize_t,
) -> *mut core::ffi::c_void;
#[cfg_attr(PyPy, link_name = "PyPyBuffer_SizeFromFormat")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBuffer_SizeFromFormat")]
pub fn PyBuffer_SizeFromFormat(format: *const c_char) -> Py_ssize_t;
#[cfg_attr(PyPy, link_name = "PyPyBuffer_ToContiguous")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBuffer_ToContiguous")]
pub fn PyBuffer_ToContiguous(
buf: *mut core::ffi::c_void,
view: *mut Py_buffer,
len: Py_ssize_t,
order: c_char,
) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyBuffer_FromContiguous")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBuffer_FromContiguous")]
pub fn PyBuffer_FromContiguous(
view: *mut Py_buffer,
buf: *mut core::ffi::c_void,
len: Py_ssize_t,
order: c_char,
) -> c_int;
pub fn PyObject_CopyData(dest: *mut PyObject, src: *mut PyObject) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyBuffer_IsContiguous")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBuffer_IsContiguous")]
pub fn PyBuffer_IsContiguous(view: *const Py_buffer, fort: c_char) -> c_int;
pub fn PyBuffer_FillContiguousStrides(
ndims: c_int,
Expand All @@ -215,7 +215,7 @@ extern_libpython! {
itemsize: c_int,
fort: c_char,
);
#[cfg_attr(PyPy, link_name = "PyPyBuffer_FillInfo")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBuffer_FillInfo")]
pub fn PyBuffer_FillInfo(
view: *mut Py_buffer,
o: *mut PyObject,
Expand All @@ -224,7 +224,7 @@ extern_libpython! {
readonly: c_int,
flags: c_int,
) -> c_int;
#[cfg_attr(PyPy, link_name = "PyPyBuffer_Release")]
#[cfg_attr(all(PyPy, not(Py_3_12)), link_name = "PyPyBuffer_Release")]
pub fn PyBuffer_Release(view: *mut Py_buffer);
}

Expand Down
1 change: 1 addition & 0 deletions pyo3-ffi/src/cpython/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ extern_libpython! {
firstlineno: c_int,
) -> *mut PyCodeObject;
#[cfg(not(GraalPy))]
#[cfg_attr(PyPy, link_name = "PyPyCode_Addr2Line")]
pub fn PyCode_Addr2Line(arg1: *mut PyCodeObject, arg2: c_int) -> c_int;
// skipped PyCodeAddressRange "for internal use only"
// skipped _PyCode_CheckLineNumber
Expand Down
Loading
Loading