@@ -12,7 +12,7 @@ use std::collections::HashSet;
1212use bsp:: { bsp_build, bsp_build_fpolys, bsp_calc_stats, bsp_merge_coplanars, bsp_opt_geom, EBspOptimization , FBspStats } ;
1313use fpoly:: { EPolyFlags , FPOLY_VERTEX_THRESHOLD } ;
1414use model:: { FBspNode , FBspSurf , FVert , UModel } ;
15- use pyo3:: prelude:: * ;
15+ use pyo3:: { prelude:: * , IntoPyObjectExt } ;
1616use 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
396400impl 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