update ffi structures for PyPy 7.3.15
This commit is contained in:
parent
3af73fabcf
commit
11b5ae7f5f
1
newsfragments/3757.fixed.md
Normal file
1
newsfragments/3757.fixed.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Match PyPy 7.3.14 in removing PyPy-only symbol `Py_MAX_NDIMS` in favour of `PyBUF_MAX_NDIM`.
|
|
@ -22,9 +22,6 @@ mod bufferinfo {
|
||||||
use std::os::raw::{c_char, c_int, c_void};
|
use std::os::raw::{c_char, c_int, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
#[cfg(PyPy)]
|
|
||||||
const Py_MAX_NDIMS: usize = if cfg!(Py_3_9) { 64 } else { 36 };
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Py_buffer {
|
pub struct Py_buffer {
|
||||||
|
@ -43,9 +40,9 @@ mod bufferinfo {
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
pub flags: c_int,
|
pub flags: c_int,
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
pub _strides: [Py_ssize_t; Py_MAX_NDIMS],
|
pub _strides: [Py_ssize_t; PyBUF_MAX_NDIM as usize],
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
pub _shape: [Py_ssize_t; Py_MAX_NDIMS],
|
pub _shape: [Py_ssize_t; PyBUF_MAX_NDIM as usize],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Py_buffer {
|
impl Py_buffer {
|
||||||
|
@ -65,9 +62,9 @@ mod bufferinfo {
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
flags: 0,
|
flags: 0,
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
_strides: [0; Py_MAX_NDIMS],
|
_strides: [0; PyBUF_MAX_NDIM as usize],
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
_shape: [0; Py_MAX_NDIMS],
|
_shape: [0; PyBUF_MAX_NDIM as usize],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +78,7 @@ mod bufferinfo {
|
||||||
unsafe extern "C" fn(arg1: *mut crate::PyObject, arg2: *mut Py_buffer);
|
unsafe extern "C" fn(arg1: *mut crate::PyObject, arg2: *mut Py_buffer);
|
||||||
|
|
||||||
/// Maximum number of dimensions
|
/// Maximum number of dimensions
|
||||||
pub const PyBUF_MAX_NDIM: c_int = 64;
|
pub const PyBUF_MAX_NDIM: c_int = if cfg!(PyPy) { 36 } else { 64 };
|
||||||
|
|
||||||
/* Flags for getting buffers */
|
/* Flags for getting buffers */
|
||||||
pub const PyBUF_SIMPLE: c_int = 0;
|
pub const PyBUF_SIMPLE: c_int = 0;
|
||||||
|
|
|
@ -3,9 +3,6 @@ use crate::pyport::Py_ssize_t;
|
||||||
use std::os::raw::{c_char, c_int, c_void};
|
use std::os::raw::{c_char, c_int, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
#[cfg(PyPy)]
|
|
||||||
const Py_MAX_NDIMS: usize = 36;
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct Py_buffer {
|
pub struct Py_buffer {
|
||||||
|
@ -24,9 +21,9 @@ pub struct Py_buffer {
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
pub flags: c_int,
|
pub flags: c_int,
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
pub _strides: [Py_ssize_t; Py_MAX_NDIMS],
|
pub _strides: [Py_ssize_t; PyBUF_MAX_NDIM],
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
pub _shape: [Py_ssize_t; Py_MAX_NDIMS],
|
pub _shape: [Py_ssize_t; PyBUF_MAX_NDIM],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Py_buffer {
|
impl Py_buffer {
|
||||||
|
@ -46,9 +43,9 @@ impl Py_buffer {
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
flags: 0,
|
flags: 0,
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
_strides: [0; Py_MAX_NDIMS],
|
_strides: [0; PyBUF_MAX_NDIM],
|
||||||
#[cfg(PyPy)]
|
#[cfg(PyPy)]
|
||||||
_shape: [0; Py_MAX_NDIMS],
|
_shape: [0; PyBUF_MAX_NDIM],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +102,7 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Maximum number of dimensions
|
/// Maximum number of dimensions
|
||||||
pub const PyBUF_MAX_NDIM: c_int = 64;
|
pub const PyBUF_MAX_NDIM: c_int = if cfg!(PyPy) { 36 } else { 64 };
|
||||||
|
|
||||||
/* Flags for getting buffers */
|
/* Flags for getting buffers */
|
||||||
pub const PyBUF_SIMPLE: c_int = 0;
|
pub const PyBUF_SIMPLE: c_int = 0;
|
||||||
|
|
Loading…
Reference in a new issue