Skip to content

Commit e0c3b64

Browse files
committed
Make it compatible with PyO3 0.10
1 parent e8b3ced commit e0c3b64

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ libc = "0.2"
1515
num-complex = "0.2"
1616
num-traits = "0.2"
1717
ndarray = ">=0.13"
18-
pyo3 = "0.9.0"
18+
pyo3 = { path = "../pyo3" }
1919

2020
[features]
2121
# In default setting, python version is automatically detected

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ numpy = "0.8.0"
6262

6363
```rust
6464
use numpy::{PyArray1, get_array_module};
65-
use pyo3::prelude::{ObjectProtocol, PyResult, Python};
65+
use pyo3::prelude::{PyResult, Python};
6666
use pyo3::types::PyDict;
6767

6868
fn main() -> Result<(), ()> {

src/array.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use crate::types::{NpyDataType, TypeNum};
7777
/// );
7878
/// # }
7979
/// ```
80-
pub struct PyArray<T, D>(PyObject, PhantomData<T>, PhantomData<D>);
80+
pub struct PyArray<T, D>(PyAny, PhantomData<T>, PhantomData<D>);
8181

8282
/// one-dimensional array
8383
pub type PyArray1<T> = PyArray<T, Ix1>;
@@ -139,8 +139,8 @@ impl<'a, T: TypeNum, D: Dimension> FromPyObject<'a> for &'a PyArray<T, D> {
139139
}
140140

141141
impl<T, D> IntoPy<PyObject> for PyArray<T, D> {
142-
fn into_py(self, _py: Python<'_>) -> PyObject {
143-
self.0
142+
fn into_py(self, py: Python<'_>) -> PyObject {
143+
unsafe { PyObject::from_borrowed_ptr(py, self.as_ptr()) }
144144
}
145145
}
146146

src/slice_box.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use pyo3::class::methods::{PyMethodDefType, PyMethodsProtocol};
1+
use pyo3::class::methods::PyMethodsImpl;
22
use pyo3::pyclass::{PyClass, PyClassAlloc};
33
use pyo3::pyclass_slots::PyClassDummySlot;
44
use pyo3::{ffi, type_object, types::PyAny, PyCell, PyClassInitializer};
@@ -49,8 +49,4 @@ unsafe impl<T> type_object::PyTypeInfo for SliceBox<T> {
4949
}
5050
}
5151

52-
impl<T> PyMethodsProtocol for SliceBox<T> {
53-
fn py_methods() -> Vec<&'static PyMethodDefType> {
54-
Vec::new()
55-
}
56-
}
52+
impl<T> PyMethodsImpl for SliceBox<T> {}

0 commit comments

Comments
 (0)