Skip to content

Commit b51c42e

Browse files
authored
remove depythonize_bound (#83)
* remove `depythonize_bound` * cleanup
1 parent f2947c9 commit b51c42e

File tree

5 files changed

+9
-20
lines changed

5 files changed

+9
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
### Packaging
44
- Update to PyO3 0.24
55

6+
## Removed
7+
- Remove deprecated `depythonize_bound()`
8+
69
## 0.23.0 - 2024-11-22
710

811
### Packaging

src/de.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pyo3::{types::*, Bound};
2-
use serde::de::{self, DeserializeOwned, IntoDeserializer};
2+
use serde::de::{self, IntoDeserializer};
33
use serde::Deserialize;
44

55
use crate::error::{ErrorImpl, PythonizeError, Result};
@@ -12,15 +12,6 @@ where
1212
T::deserialize(&mut Depythonizer::from_object(obj))
1313
}
1414

15-
/// Attempt to convert a Python object to an instance of `T`
16-
#[deprecated(since = "0.22.0", note = "use `depythonize` instead")]
17-
pub fn depythonize_bound<T>(obj: Bound<PyAny>) -> Result<T>
18-
where
19-
T: DeserializeOwned,
20-
{
21-
T::deserialize(&mut Depythonizer::from_object(&obj))
22-
}
23-
2415
/// A structure that deserializes Python objects into Rust values
2516
pub struct Depythonizer<'a, 'py> {
2617
input: &'a Bound<'py, PyAny>,
@@ -541,12 +532,9 @@ mod test {
541532
let obj = py.eval(code, None, None).unwrap();
542533
let actual: T = depythonize(&obj).unwrap();
543534
assert_eq!(&actual, expected);
535+
544536
let actual_json: JsonValue = depythonize(&obj).unwrap();
545537
assert_eq!(&actual_json, expected_json);
546-
547-
#[allow(deprecated)]
548-
let actual: T = depythonize_bound(obj.clone()).unwrap();
549-
assert_eq!(&actual, expected);
550538
});
551539
}
552540

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ mod de;
44
mod error;
55
mod ser;
66

7-
#[allow(deprecated)]
8-
pub use crate::de::depythonize_bound;
97
pub use crate::de::{depythonize, Depythonizer};
108
pub use crate::error::{PythonizeError, Result};
119
pub use crate::ser::{

src/ser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub trait PythonizeListType: Sized {
5555
fn create_sequence<'py, T, U>(
5656
py: Python<'py>,
5757
elements: impl IntoIterator<Item = T, IntoIter = U>,
58-
) -> PyResult<Bound<PySequence>>
58+
) -> PyResult<Bound<'py, PySequence>>
5959
where
6060
T: IntoPyObject<'py>,
6161
U: ExactSizeIterator<Item = T>;
@@ -130,7 +130,7 @@ impl PythonizeListType for PyList {
130130
fn create_sequence<'py, T, U>(
131131
py: Python<'py>,
132132
elements: impl IntoIterator<Item = T, IntoIter = U>,
133-
) -> PyResult<Bound<PySequence>>
133+
) -> PyResult<Bound<'py, PySequence>>
134134
where
135135
T: IntoPyObject<'py>,
136136
U: ExactSizeIterator<Item = T>,
@@ -143,7 +143,7 @@ impl PythonizeListType for PyTuple {
143143
fn create_sequence<'py, T, U>(
144144
py: Python<'py>,
145145
elements: impl IntoIterator<Item = T, IntoIter = U>,
146-
) -> PyResult<Bound<PySequence>>
146+
) -> PyResult<Bound<'py, PySequence>>
147147
where
148148
T: IntoPyObject<'py>,
149149
U: ExactSizeIterator<Item = T>,

tests/test_custom_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl PythonizeListType for CustomList {
3636
fn create_sequence<'py, T, U>(
3737
py: Python<'py>,
3838
elements: impl IntoIterator<Item = T, IntoIter = U>,
39-
) -> PyResult<Bound<PySequence>>
39+
) -> PyResult<Bound<'py, PySequence>>
4040
where
4141
T: IntoPyObject<'py>,
4242
U: ExactSizeIterator<Item = T>,

0 commit comments

Comments
 (0)