upgrade to pyo3 0.26

Fixes #223
This commit is contained in:
Willi Ballenthin 2025-09-25 22:59:59 +00:00
parent 0b3f2cb999
commit 8af9cb823b
4 changed files with 9 additions and 9 deletions

View file

@ -14,7 +14,7 @@ crate-type = ["cdylib"]
[dependencies]
lancelot-flirt = { path = "../flirt", version = "0.9.7" }
pyo3 = { version = "0.22"}
pyo3 = { version = "0.26"}
anyhow = "1"
[features]

View file

@ -49,7 +49,7 @@ pub struct FlirtSignature {
#[pymethods]
impl FlirtSignature {
#[getter]
pub fn names(&self, py: Python) -> Vec<PyObject> {
pub fn names(&self, py: Python) -> Vec<Py<PyAny>> {
self.inner
.names
.iter()
@ -66,9 +66,9 @@ impl FlirtSignature {
}
};
let data = [name.into_py(py), ty.into_py(py), offset.into_py(py)];
let data = [name.into_pyobject(py).unwrap().into_any().unbind(), ty.into_pyobject(py).unwrap().into_any().unbind(), offset.into_pyobject(py).unwrap().into_any().unbind()];
PyTuple::new_bound(py, data.iter()).to_object(py)
PyTuple::new(py, data.iter()).unwrap().into_any().unbind()
})
.collect()
}
@ -122,8 +122,8 @@ impl FlirtMatcher {
}
#[pyfunction]
pub fn compile(py: Python, sigs: &Bound<'_, PyList>) -> PyResult<FlirtMatcher> {
let sigs = match sigs.to_object(py).extract::<Vec<FlirtSignature>>(py) {
pub fn compile(_py: Python, sigs: &Bound<'_, PyList>) -> PyResult<FlirtMatcher> {
let sigs = match sigs.extract::<Vec<FlirtSignature>>() {
Err(_) => {
return Err(pyo3::exceptions::PyValueError::new_err(String::from(
"must pass only `FlirtSignature` instances to `compile`",

View file

@ -12,8 +12,8 @@ crate-type = ["cdylib"]
[dependencies]
lancelot = { path = "../core", version = "0.9.7" }
pyo3 = { version = "0.22" }
pyo3-log = "0.11"
pyo3 = { version = "0.26" }
pyo3-log = "0.13"
anyhow = "1"
sha256 = "1"

View file

@ -96,7 +96,7 @@ pub fn binexport2_from_bytes(
let ws = ::lancelot::workspace::workspace_from_bytes(config, buf.as_bytes()).map_err(to_py_err)?;
let hash = sha256::digest(buf.as_bytes());
export_workspace_to_binexport2(&*ws, hash, executable_id)
.map(|buf| PyBytes::new_bound(py, &buf).into())
.map(|buf| PyBytes::new(py, &buf).unbind())
.map_err(to_py_err)
}