diff --git a/Cargo.lock b/Cargo.lock index bb32d7d4..ce333923 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -922,9 +922,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.22.5" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d922163ba1f79c04bc49073ba7b32fd5a8d3b76a87c955921234b8e77333c51" +checksum = "e484fd2c8b4cb67ab05a318f1fd6fa8f199fcc30819f08f07d200809dba26c15" dependencies = [ "cfg-if", "indoc", @@ -940,9 +940,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.22.5" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc38c5feeb496c8321091edf3d63e9a6829eab4b863b4a6a65f26f3e9cc6b179" +checksum = "dc0e0469a84f208e20044b98965e1561028180219e35352a2afaf2b942beff3b" dependencies = [ "once_cell", "target-lexicon 0.12.16", @@ -950,9 +950,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.22.5" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94845622d88ae274d2729fcefc850e63d7a3ddff5e3ce11bd88486db9f1d357d" +checksum = "eb1547a7f9966f6f1a0f0227564a9945fe36b90da5a93b3933fc3dc03fae372d" dependencies = [ "libc", "pyo3-build-config", @@ -960,9 +960,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.22.5" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e655aad15e09b94ffdb3ce3d217acf652e26bbc37697ef012f5e5e348c716e5e" +checksum = "fdb6da8ec6fa5cedd1626c886fc8749bdcbb09424a86461eb8cdf096b7c33257" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -972,9 +972,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.22.5" +version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1e3f09eecd94618f60a455a23def79f79eba4dc561a97324bf9ac8c6df30ce" +checksum = "38a385202ff5a92791168b1136afae5059d3ac118457bb7bc304c197c2d33e7d" dependencies = [ "heck 0.5.0", "proc-macro2", diff --git a/pyapi/Cargo.toml b/pyapi/Cargo.toml index 367aebcb..3d7e97fb 100644 --- a/pyapi/Cargo.toml +++ b/pyapi/Cargo.toml @@ -15,14 +15,14 @@ build = "build.rs" [dependencies] rustsat.workspace = true -pyo3 = { version = "0.22.5", features = [ +pyo3 = { version = "0.23.3", features = [ "extension-module", "abi3", "abi3-py37", ] } [build-dependencies] -pyo3-build-config = { version = "0.22.2" } +pyo3-build-config = { version = "0.23.3" } [lib] crate-type = ["cdylib"] diff --git a/pyapi/src/lib.rs b/pyapi/src/lib.rs index 3ce21fea..c3ede98d 100644 --- a/pyapi/src/lib.rs +++ b/pyapi/src/lib.rs @@ -28,23 +28,12 @@ use crate::{ types::{Clause, Lit}, }; +#[derive(IntoPyObject)] pub(crate) enum SingleOrList { Single(T), List(Vec), } -impl IntoPy for SingleOrList -where - T: IntoPy, -{ - fn into_py(self, py: Python<'_>) -> PyObject { - match self { - SingleOrList::Single(single) => single.into_py(py), - SingleOrList::List(list) => list.into_py(py), - } - } -} - /// Python bindings for the RustSAT library #[pymodule] fn rustsat(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { @@ -53,14 +42,14 @@ fn rustsat(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_class::()?; m.add_class::()?; - let encodings = PyModule::new_bound(py, "rustsat.encodings")?; + let encodings = PyModule::new(py, "rustsat.encodings")?; encodings.add_class::()?; encodings.add_class::()?; encodings.add_class::()?; m.add("encodings", &encodings)?; // To import encodings. Fix from https://github.com/PyO3/pyo3/issues/759 - py.import_bound("sys")? + py.import("sys")? .getattr("modules")? .set_item("rustsat.encodings", &encodings)?;