Skip to content

Commit 489aa26

Browse files
committed
Remove the PyArray_* allocation functions again, but give users a hint where to find the underlying PyO3 functions.
This reverts commit 712626b.
1 parent 712626b commit 489aa26

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ num-traits = "0.2"
2121
ndarray = ">= 0.13, < 0.16"
2222
pyo3 = { version = "0.16", default-features = false }
2323

24-
[build-dependencies]
25-
pyo3-build-config = "0.16"
26-
2724
[dev-dependencies]
2825
pyo3 = { version = "0.16", features = ["auto-initialize"] }
2926

build.rs

-5
This file was deleted.

src/npyffi/array.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
//! Low-Level binding for [Array API](https://numpy.org/doc/stable/reference/c-api/array.html)
2-
use libc::FILE;
2+
//!
3+
//! Note that NumPy's low-level allocation functions `PyArray_{malloc,realloc,free}` are not part of this module.
4+
//! The reason that they would be re-exports of the `PyMem_Raw{Malloc,Realloc,Free}` functions from PyO3,
5+
//! but those are not unconditionally exported, i.e. they are not available when using the limited Python C-API.
6+
37
use std::cell::Cell;
48
use std::os::raw::*;
59
use std::ptr::null;
610

11+
use libc::FILE;
712
use pyo3::ffi::{self, PyObject, PyTypeObject};
813

914
use crate::npyffi::*;
@@ -394,13 +399,6 @@ pub unsafe fn PyArray_CheckExact(py: Python, op: *mut PyObject) -> c_int {
394399
(ffi::Py_TYPE(op) == PY_ARRAY_API.get_type_object(py, NpyTypes::PyArray_Type)) as _
395400
}
396401

397-
// these are under `#if NPY_USE_PYMEM == 1` which seems to be always defined as 1
398-
#[cfg(not(Py_LIMITED_API))]
399-
pub use pyo3::ffi::{
400-
PyMem_RawFree as PyArray_free, PyMem_RawMalloc as PyArray_malloc,
401-
PyMem_RawRealloc as PyArray_realloc,
402-
};
403-
404402
#[cfg(test)]
405403
mod tests {
406404
use super::PY_ARRAY_API;

0 commit comments

Comments
 (0)