diff --git a/CHANGELOG.md b/CHANGELOG.md index 2142e27..049548e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ This changelog track changes to the qoqo_calculator project starting at version 0.6.0 +## 1.2.1 + +* Fixes a compatibility issue for from_pyany with struqture and qoqo. + ## 1.2.0 * Update to pyo3 0.21 diff --git a/Cargo.lock b/Cargo.lock index 4b59ff4..a673140 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -198,7 +198,7 @@ dependencies = [ [[package]] name = "qoqo_calculator" -version = "1.2.0" +version = "1.2.1" dependencies = [ "num-complex", "schemars", @@ -210,7 +210,7 @@ dependencies = [ [[package]] name = "qoqo_calculator_pyo3" -version = "1.2.0" +version = "1.2.1" dependencies = [ "num-complex", "pyo3", diff --git a/qoqo_calculator/Cargo.toml b/qoqo_calculator/Cargo.toml index 436b2ad..5b80dfc 100644 --- a/qoqo_calculator/Cargo.toml +++ b/qoqo_calculator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "qoqo_calculator" -version = "1.2.0" +version = "1.2.1" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" @@ -15,10 +15,10 @@ name = "qoqo_calculator" crate-type = ["rlib"] [dependencies] -num-complex = {version= "0.4", features=['serde']} +num-complex = { version = "0.4", features = ['serde'] } serde = { version = '1.0', features = ["derive"] } thiserror = "1.0" -schemars = { version = "0.8", optional=true } +schemars = { version = "0.8", optional = true } [dev-dependencies] diff --git a/qoqo_calculator_pyo3/Cargo.toml b/qoqo_calculator_pyo3/Cargo.toml index 68acc16..839ba91 100644 --- a/qoqo_calculator_pyo3/Cargo.toml +++ b/qoqo_calculator_pyo3/Cargo.toml @@ -1,13 +1,19 @@ [package] name = "qoqo_calculator_pyo3" -version = "1.2.0" +version = "1.2.1" authors = ["HQS Quantum Simulations "] license = "Apache-2.0" edition = "2021" readme = "README.md" repository = "https://github.com/HQSquantumsimulations/qoqo_calculator_pyo3" description = "Python interface to qoqo calculator, the calculator backend of the qoqo quantum computing toolkit by HQS Quantum Simulations" -include = ["src*", "qoqo_calculator_pyo3", "LICENSE", "pyproject.toml", "README.md"] +include = [ + "src*", + "qoqo_calculator_pyo3", + "LICENSE", + "pyproject.toml", + "README.md", +] [lib] name = "qoqo_calculator_pyo3" @@ -16,8 +22,8 @@ crate-type = ["cdylib", "rlib"] [dependencies] num-complex = "0.4" -qoqo_calculator = {version="1.2", path="../qoqo_calculator"} -serde = "1.0" +qoqo_calculator = { version = "1.2", path = "../qoqo_calculator" } +serde = "1.0" thiserror = "1.0" [dependencies.pyo3] @@ -29,4 +35,4 @@ pyo3-build-config = "0.21" [features] extension-module = ["pyo3/extension-module"] -default = ["extension-module"] +default = ["extension-module"] diff --git a/qoqo_calculator_pyo3/pyproject.toml b/qoqo_calculator_pyo3/pyproject.toml index d7fb355..604f5b0 100644 --- a/qoqo_calculator_pyo3/pyproject.toml +++ b/qoqo_calculator_pyo3/pyproject.toml @@ -1,8 +1,10 @@ [project] name = "qoqo_calculator_pyo3" -version = "1.2.0" -license = {text="Apache-2.0 AND Apache-2.0 with LLVM-exception AND MIT AND Unicode-DFS-2016"} -maintainers = [{name = "HQS Quantum Simulations GmbH", email = "info@quantumsimulations.de"}] +version = "1.2.1" +license = { text = "Apache-2.0 AND Apache-2.0 with LLVM-exception AND MIT AND Unicode-DFS-2016" } +maintainers = [ + { name = "HQS Quantum Simulations GmbH", email = "info@quantumsimulations.de" }, +] requires-python = ">=3.8" [build-system] @@ -25,5 +27,5 @@ docs = [ "myst_parser", "sphinx_rtd_theme", "tomli", - "numpy" + "numpy", ] diff --git a/qoqo_calculator_pyo3/qoqo_calculator_pyo3/DEPENDENCIES b/qoqo_calculator_pyo3/qoqo_calculator_pyo3/DEPENDENCIES index dd36aad..d1f373d 100644 --- a/qoqo_calculator_pyo3/qoqo_calculator_pyo3/DEPENDENCIES +++ b/qoqo_calculator_pyo3/qoqo_calculator_pyo3/DEPENDENCIES @@ -4660,7 +4660,7 @@ LICENSE-APACHE: ==================================================== -qoqo_calculator 1.2.0 +qoqo_calculator 1.2.1 https://github.com/HQSquantumsimulations/qoqo_calculator by HQS Quantum Simulations qoqo-calculator is the calculator backend of the qoqo quantum computing toolkit by HQS Quantum Simulations @@ -4872,7 +4872,7 @@ LICENSE: ==================================================== -qoqo_calculator_pyo3 1.2.0 +qoqo_calculator_pyo3 1.2.1 https://github.com/HQSquantumsimulations/qoqo_calculator_pyo3 by HQS Quantum Simulations Python interface to qoqo calculator, the calculator backend of the qoqo quantum computing toolkit by HQS Quantum Simulations diff --git a/qoqo_calculator_pyo3/src/calculator_complex.rs b/qoqo_calculator_pyo3/src/calculator_complex.rs index cd0b6f0..6656ab2 100644 --- a/qoqo_calculator_pyo3/src/calculator_complex.rs +++ b/qoqo_calculator_pyo3/src/calculator_complex.rs @@ -576,9 +576,12 @@ impl CalculatorComplexWrapper { } impl CalculatorComplexWrapper { - pub fn from_pyany(input: &Bound) -> PyResult { - convert_into_calculator_complex(input).map_err(|err| { - PyValueError::new_err(format!("Error in convert_to_calculator_complex: {err:?}")) + pub fn from_pyany(input: Py) -> PyResult { + Python::with_gil(|py| -> PyResult { + let input = input.bind(py); + convert_into_calculator_complex(input).map_err(|err| { + PyValueError::new_err(format!("Error in convert_to_calculator_complex: {err:?}")) + }) }) } } diff --git a/qoqo_calculator_pyo3/src/calculator_float.rs b/qoqo_calculator_pyo3/src/calculator_float.rs index ab8f990..2a0351c 100644 --- a/qoqo_calculator_pyo3/src/calculator_float.rs +++ b/qoqo_calculator_pyo3/src/calculator_float.rs @@ -592,9 +592,12 @@ impl CalculatorFloatWrapper { } impl CalculatorFloatWrapper { - pub fn from_pyany(input: &Bound) -> PyResult { - convert_into_calculator_float(input).map_err(|err| { - PyValueError::new_err(format!("Error in convert_to_calculator_float: {err:?}")) + pub fn from_pyany(input: Py) -> PyResult { + Python::with_gil(|py| -> PyResult { + let input = input.bind(py); + convert_into_calculator_float(input).map_err(|err| { + PyValueError::new_err(format!("Error in convert_to_calculator_float: {err:?}")) + }) }) } }