Skip to content

Commit

Permalink
chore: update to pyo3 0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Mar 28, 2024
1 parent 5dd2bed commit f6c81cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rustsat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ rand = { version = "0.8.5", optional = true }
visibility = { version = "0.1.0" }
anyhow = { version = "1.0.80" }
thiserror = { version = "1.0.50" }
pyo3 = { version = "0.20.0", optional = true, features = [
pyo3 = { version = "0.21.0", optional = true, features = [
"extension-module",
"abi3",
"abi3-py37",
] }

[build-dependencies]
cbindgen = "0.26.0"
pyo3-build-config = { version = "0.20.0", optional = true }
pyo3-build-config = { version = "0.21.0", optional = true }

[dev-dependencies]
inline-c = "0.1.7"
Expand Down
10 changes: 5 additions & 5 deletions rustsat/src/pyapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ where

/// Python bindings for the RustSAT library
#[pymodule]
fn rustsat(py: Python<'_>, m: &PyModule) -> PyResult<()> {
fn rustsat(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<Lit>()?;
m.add_class::<Clause>()?;
m.add_class::<Cnf>()?;
m.add_class::<BasicVarManager>()?;

let encodings = PyModule::new(py, "rustsat.encodings")?;
let encodings = PyModule::new_bound(py, "rustsat.encodings")?;
encodings.add_class::<DbTotalizer>()?;
encodings.add_class::<DbGte>()?;
encodings.add_class::<DynamicPolyWatchdog>()?;
m.add("encodings", encodings)?;
m.add("encodings", &encodings)?;

// To import encodings. Fix from https://github.com/PyO3/pyo3/issues/759
py.import("sys")?
py.import_bound("sys")?
.getattr("modules")?
.set_item("rustsat.encodings", encodings)?;
.set_item("rustsat.encodings", &encodings)?;

Ok(())
}

0 comments on commit f6c81cf

Please sign in to comment.