Skip to content

Commit

Permalink
feat: update to pyo3 23 (allow free-threaded python) (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 authored Nov 29, 2024
1 parent edff4bd commit 1223306
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
56 changes: 28 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ path = "tests/lib.rs"
[workspace.dependencies]
derive_more = "1.0.0"
itertools = "0.13.0"
pyo3 = "0.22.2"
pythonize = "0.22.0"
pyo3 = "0.23.2"
pythonize = "0.23.0"
rstest = "0.23.0"
serde = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/pytket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl SerialCircuit {
/// Convert a `SerialCircuit` to a `pytket.Circuit`.
pub fn to_tket1<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> {
let dict = pythonize(py, self).unwrap();
let circ_module = PyModule::import_bound(py, "pytket.circuit")?;
let circ_module = PyModule::import(py, "pytket.circuit")?;

circ_module
.getattr("Circuit")?
Expand Down
4 changes: 2 additions & 2 deletions tests/missing_optypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn missing_optypes() -> PyResult<()> {

pyo3::prepare_freethreaded_python();
Python::with_gil(|py| {
let Ok(pytket) = PyModule::import_bound(py, "pytket") else {
let Ok(pytket) = PyModule::import(py, "pytket") else {
panic!("Failed to import `pytket`. Make sure the python library is installed.");
};
let py_enum = pytket.getattr("OpType")?;
Expand Down Expand Up @@ -67,7 +67,7 @@ fn missing_classical_optypes() -> PyResult<()> {

pyo3::prepare_freethreaded_python();
Python::with_gil(|py| {
let Ok(pytket) = PyModule::import_bound(py, "pytket") else {
let Ok(pytket) = PyModule::import(py, "pytket") else {
panic!("Failed to import `pytket`. Make sure the python library is installed.");
};
let py_enum = pytket.getattr("circuit")?.getattr("ClOp")?;
Expand Down

0 comments on commit 1223306

Please sign in to comment.