diff --git a/Cargo.lock b/Cargo.lock index 43dc262..11de88f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -135,24 +135,10 @@ dependencies = [ [[package]] name = "indoc" -version = "0.3.6" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47741a8bc60fb26eb8d6e0238bbb26d8575ff623fdc97b1a2c00c050b9684ed8" +checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e" dependencies = [ - "indoc-impl", - "proc-macro-hack", -] - -[[package]] -name = "indoc-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce046d161f000fffde5f432a0d034d0341dc152643b2598ed5bfce44c4f3a8f0" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", "unindent", ] @@ -167,24 +153,12 @@ dependencies = [ [[package]] name = "inventory" -version = "0.1.11" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb5160c60ba1e809707918ee329adb99d222888155835c6feedba19f6c3fd4" +checksum = "ce6b5d8c669bfbad811d95ddd7a1c6cf9cfdbf2777e59928b6f3fa8ff54f72a0" dependencies = [ "ctor", "ghost", - "inventory-impl", -] - -[[package]] -name = "inventory-impl" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e41b53715c6f0c4be49510bb82dee2c1e51c8586d885abe65396e82ed518548" -dependencies = [ - "proc-macro2", - "quote", - "syn", ] [[package]] @@ -292,25 +266,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "paste" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" -dependencies = [ - "paste-impl", - "proc-macro-hack", -] - -[[package]] -name = "paste-impl" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" -dependencies = [ - "proc-macro-hack", -] - [[package]] name = "petgraph" version = "0.6.0" @@ -384,12 +339,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" -[[package]] -name = "proc-macro-hack" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" - [[package]] name = "proc-macro2" version = "1.0.37" @@ -401,36 +350,48 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.14.5" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35100f9347670a566a67aa623369293703322bb9db77d99d7df7313b575ae0c8" +checksum = "6b3e99c4c3e790e4fc365b42b70c1f7801f42eadc4ea648fa327e6f5ca29f215" dependencies = [ "cfg-if", "indoc", "inventory", "libc", "parking_lot", - "paste", "pyo3-build-config", + "pyo3-ffi", "pyo3-macros", "unindent", ] [[package]] name = "pyo3-build-config" -version = "0.14.5" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d12961738cacbd7f91b7c43bc25cfeeaa2698ad07a04b3be0aa88b950865738f" +checksum = "2486b96281859ff0a3929ba6467b13751627b974f7137362db38e2bed14b2094" dependencies = [ "once_cell", + "target-lexicon", +] + +[[package]] +name = "pyo3-ffi" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd9de1d94557751599f8bd321f10e6c1ef2801067acb58c91138deef2ae83a17" +dependencies = [ + "libc", + "pyo3-build-config", ] [[package]] name = "pyo3-macros" -version = "0.14.5" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0bc5215d704824dfddddc03f93cb572e1155c68b6761c37005e1c288808ea8" +checksum = "0b9584049129b1cfb615243391a6345c726690271ae195ffd6aa3766177296aa" dependencies = [ + "proc-macro2", "pyo3-macros-backend", "quote", "syn", @@ -438,12 +399,11 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.14.5" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71623fc593224afaab918aa3afcaf86ed2f43d34f6afde7f3922608f253240df" +checksum = "b6c4717e6a55c51a9958eda1f5481ff7f62cccd21f45309c10e4731cb7198dbc" dependencies = [ "proc-macro2", - "pyo3-build-config", "quote", "syn", ] @@ -573,6 +533,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "target-lexicon" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fa7e55043acb85fca6b3c01485a2eeb6b69c5d21002e273c79e465f43b7ac1" + [[package]] name = "termcolor" version = "1.1.3" diff --git a/disasm-py/Cargo.toml b/disasm-py/Cargo.toml index c05ce1a..1c4ae0f 100644 --- a/disasm-py/Cargo.toml +++ b/disasm-py/Cargo.toml @@ -16,5 +16,5 @@ extension-module = ["pyo3/extension-module"] default = ["extension-module"] [dependencies] -pyo3 = { version = "0.14", features = ["multiple-pymethods"] } +pyo3 = { version = "0.16", features = ["multiple-pymethods"] } ppc750cl = { version = "0.1.1", path = "../disasm" } diff --git a/disasm-py/src/lib.rs b/disasm-py/src/lib.rs index 6a2c9a5..0288041 100644 --- a/disasm-py/src/lib.rs +++ b/disasm-py/src/lib.rs @@ -1,6 +1,5 @@ use pyo3::prelude::*; use pyo3::types::PyBytes; -use pyo3::{PyIterProtocol, PyObjectProtocol}; use ppc750cl::formatter::FormattedIns; @@ -23,6 +22,10 @@ impl Ins { fn addr(&self) -> PyResult { Ok(self.0.addr) } + + fn __str__(&self) -> String { + FormattedIns(self.0.clone()).to_string() + } } impl From for Ins { @@ -31,13 +34,6 @@ impl From for Ins { } } -#[pyproto] -impl<'a> PyObjectProtocol<'a> for Ins { - fn __str__(&self) -> String { - FormattedIns(self.0.clone()).to_string() - } -} - #[pyclass] struct DisasmIterator { bytes: Py, @@ -46,8 +42,8 @@ struct DisasmIterator { left: usize, } -#[pyproto] -impl PyIterProtocol for DisasmIterator { +#[pymethods] +impl DisasmIterator { fn __iter__(slf: PyRef) -> PyRef { slf }