From 6883c776ef7571fff6cf56ba12ab7770a922dcc1 Mon Sep 17 00:00:00 2001 From: Kevin Phoenix Date: Wed, 10 May 2023 11:01:51 -0700 Subject: [PATCH] Update pyo3 crate to 0.18.3 (#1255) Co-authored-by: Dongjia "toka" Zhang --- bindings/pylibafl/Cargo.toml | 2 +- libafl/Cargo.toml | 2 +- libafl_qemu/Cargo.toml | 3 +-- libafl_qemu/src/emu.rs | 8 ++++---- libafl_sugar/Cargo.toml | 3 +-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/bindings/pylibafl/Cargo.toml b/bindings/pylibafl/Cargo.toml index 41537e7da4..bad9cc8716 100644 --- a/bindings/pylibafl/Cargo.toml +++ b/bindings/pylibafl/Cargo.toml @@ -4,7 +4,7 @@ version = "0.10.0" edition = "2021" [dependencies] -pyo3 = { version = "0.17", features = ["extension-module"] } +pyo3 = { version = "0.18.3", features = ["extension-module"] } pyo3-log = "0.8.1" libafl_qemu = { path = "../../libafl_qemu", version = "0.10.0", features = ["python"] } libafl_sugar = { path = "../../libafl_sugar", version = "0.10.0", features = ["python"] } diff --git a/libafl/Cargo.toml b/libafl/Cargo.toml index 379ff7bf28..cfbdddad0e 100644 --- a/libafl/Cargo.toml +++ b/libafl/Cargo.toml @@ -100,7 +100,7 @@ wait-timeout = { version = "0.2", optional = true } # used by CommandExecutor to z3 = { version = "0.11", features = ["static-link-z3"], optional = true } # for concolic mutation -pyo3 = { version = "0.17", optional = true, features = ["serde", "macros"] } +pyo3 = { version = "0.18.3", optional = true, features = ["serde", "macros"] } concat-idents = { version = "1.1.3", optional = true } libcasr = { version = "2.5", optional = true} diff --git a/libafl_qemu/Cargo.toml b/libafl_qemu/Cargo.toml index fcff160f92..abc294bdf1 100644 --- a/libafl_qemu/Cargo.toml +++ b/libafl_qemu/Cargo.toml @@ -49,8 +49,7 @@ syscall-numbers = "3.0" meminterval = "0.3" thread_local = "1.1.4" capstone = "0.11.0" -#pyo3 = { version = "0.15", features = ["extension-module"], optional = true } -pyo3 = { version = "0.17", features = ["pyproto"], optional = true } +pyo3 = { version = "0.18.3", optional = true } rangemap = "1.0" log = "0.4.17" diff --git a/libafl_qemu/src/emu.rs b/libafl_qemu/src/emu.rs index c9f0ccb6cf..2a7c0207ad 100644 --- a/libafl_qemu/src/emu.rs +++ b/libafl_qemu/src/emu.rs @@ -85,7 +85,7 @@ impl From for MemAccessInfo { } #[cfg(feature = "python")] -use pyo3::{prelude::*, PyIterProtocol}; +use pyo3::prelude::*; pub const SKIP_EXEC_HOOK: u64 = u64::MAX; @@ -444,8 +444,8 @@ impl Iterator for GuestMaps { } #[cfg(all(emulation_mode = "usermode", feature = "python"))] -#[pyproto] -impl PyIterProtocol for GuestMaps { +#[pymethods] +impl GuestMaps { fn __iter__(slf: PyRef) -> PyRef { slf } @@ -1184,7 +1184,7 @@ pub mod pybind { if any.is_none() { SyscallHookResult::new(None) } else { - let a: Result<&PyInt, _> = any.cast_as(); + let a: Result<&PyInt, _> = any.downcast(); if let Ok(i) = a { SyscallHookResult::new(Some( i.extract().expect("Invalid syscall hook return value"), diff --git a/libafl_sugar/Cargo.toml b/libafl_sugar/Cargo.toml index fb4ee40a6a..ca42a134c4 100644 --- a/libafl_sugar/Cargo.toml +++ b/libafl_sugar/Cargo.toml @@ -32,8 +32,7 @@ libafl_targets = { path = "../libafl_targets", version = "0.10.0" } libafl_qemu = { path = "../libafl_qemu", version = "0.10.0" } typed-builder = "0.12" # Implement the builder pattern at compiletime -#pyo3 = { version = "0.17", features = ["extension-module"], optional = true } -pyo3 = { version = "0.17", optional = true } +pyo3 = { version = "0.18.3", optional = true } log = "0.4.17" [lib]