Skip to content

Commit 5b0ce40

Browse files
committed
Upgraded pyo3 to 0.25.1
1 parent a68f536 commit 5b0ce40

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ bitflags = "2.4.0"
1616
phf = { version = "0.11", features = ["macros"] }
1717

1818
[dependencies.pyo3]
19-
version = "0.21.1"
19+
version = "0.25.1"
2020
features = ["extension-module", "macros"]

src/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::collections::HashSet;
1212
use bsp::{bsp_build, bsp_build_fpolys, bsp_calc_stats, bsp_merge_coplanars, bsp_opt_geom, EBspOptimization, FBspStats};
1313
use fpoly::{EPolyFlags, FPOLY_VERTEX_THRESHOLD};
1414
use model::{FBspNode, FBspSurf, FVert, UModel};
15-
use pyo3::prelude::*;
15+
use pyo3::{prelude::*, IntoPyObjectExt};
1616
use crate::fpoly::FPoly;
1717

1818
#[pyclass]
@@ -387,14 +387,18 @@ impl ToString for EBspOptimization {
387387
}
388388
}
389389

390-
impl IntoPy<PyObject> for EBspOptimization {
391-
fn into_py(self, py: Python) -> PyObject {
392-
self.to_string().into_py(py)
390+
impl<'py> IntoPyObject<'py> for EBspOptimization {
391+
type Target = PyAny;
392+
type Output = Bound<'py, Self::Target>;
393+
type Error = pyo3::PyErr;
394+
395+
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
396+
self.to_string().into_bound_py_any(py)
393397
}
394398
}
395399

396400
impl FromPyObject<'_> for EBspOptimization {
397-
fn extract(ob: &PyAny) -> PyResult<Self> {
401+
fn extract_bound(ob: &Bound<'_, PyAny>) -> PyResult<Self> {
398402
let string = ob.extract::<String>()?;
399403
EBspOptimization::try_from(string.as_str()).map_err(|_| PyErr::new::<pyo3::exceptions::PyValueError, _>("Invalid optimization value"))
400404
}

0 commit comments

Comments
 (0)