From fa9300e3a3c823d7fb73680d1d98e668ce3e18ff Mon Sep 17 00:00:00 2001 From: Dimitris Iliopoulos Date: Thu, 15 Feb 2024 01:08:09 -0800 Subject: [PATCH] Upgrade pyo3 to 0.20 (#1106) Co-authored-by: Dimitris Iliopoulos --- native/Cargo.lock | 52 ++++++++++++++++++++----------- native/libcst/Cargo.toml | 2 +- native/libcst/src/nodes/traits.rs | 4 +-- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/native/Cargo.lock b/native/Cargo.lock index 2d3899cdf..0ae243071 100644 --- a/native/Cargo.lock +++ b/native/Cargo.lock @@ -201,7 +201,7 @@ dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.6.5", "once_cell", "scopeguard", ] @@ -261,6 +261,12 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -278,9 +284,9 @@ checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "indoc" -version = "1.0.6" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05a0bd019339e5d968b37855180087b7b9d512c5046fbd244cf8c95687927d6e" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" [[package]] name = "instant" @@ -414,6 +420,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -542,14 +557,14 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.17.3" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "268be0c73583c183f2b14052337465768c07726936a260f480f0857cb95ba543" +checksum = "9a89dc7a5850d0e983be1ec2a463a171d20990487c3cfcd68b5363f1ee3d6fe0" dependencies = [ "cfg-if", "indoc", "libc", - "memoffset", + "memoffset 0.9.0", "parking_lot", "pyo3-build-config", "pyo3-ffi", @@ -559,9 +574,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.17.3" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28fcd1e73f06ec85bf3280c48c67e731d8290ad3d730f8be9dc07946923005c8" +checksum = "07426f0d8fe5a601f26293f300afd1a7b1ed5e78b2a705870c5f30893c5163be" dependencies = [ "once_cell", "target-lexicon", @@ -569,9 +584,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.17.3" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6cb136e222e49115b3c51c32792886defbfb0adead26a688142b346a0b9ffc" +checksum = "dbb7dec17e17766b46bca4f1a4215a85006b4c2ecde122076c562dd058da6cf1" dependencies = [ "libc", "pyo3-build-config", @@ -579,25 +594,26 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.17.3" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94144a1266e236b1c932682136dc35a9dee8d3589728f68130c7c3861ef96b28" +checksum = "05f738b4e40d50b5711957f142878cfa0f28e054aa0ebdfc3fd137a843f74ed3" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 1.0.109", + "syn 2.0.41", ] [[package]] name = "pyo3-macros-backend" -version = "0.17.3" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8df9be978a2d2f0cdebabb03206ed73b11314701a5bfe71b0d753b81997777f" +checksum = "0fc910d4851847827daf9d6cdd4a823fbdaab5b8818325c5e97a86da79e8881f" dependencies = [ + "heck", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.41", ] [[package]] @@ -839,9 +855,9 @@ checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unindent" -version = "0.1.9" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52fee519a3e570f7df377a06a1a7775cdbfb7aa460be7e08de2b1f0e69973a44" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" [[package]] name = "walkdir" diff --git a/native/libcst/Cargo.toml b/native/libcst/Cargo.toml index e96d4bc4a..737f71b91 100644 --- a/native/libcst/Cargo.toml +++ b/native/libcst/Cargo.toml @@ -36,7 +36,7 @@ trace = ["peg/trace"] [dependencies] paste = "1.0.9" -pyo3 = { version = ">=0.17,<0.20", optional = true } +pyo3 = { version = "0.20", optional = true } thiserror = "1.0.37" peg = "0.8.1" chic = "1.2.2" diff --git a/native/libcst/src/nodes/traits.rs b/native/libcst/src/nodes/traits.rs index 1efa29fc2..1dd58132c 100644 --- a/native/libcst/src/nodes/traits.rs +++ b/native/libcst/src/nodes/traits.rs @@ -118,7 +118,7 @@ impl<'a, T: Inflate<'a>> Inflate<'a> for Vec { } #[cfg(feature = "py")] pub mod py { - use pyo3::{types::PyTuple, AsPyPointer, IntoPy, PyObject, PyResult, Python}; + use pyo3::{types::PyAny, types::PyTuple, IntoPy, PyObject, PyResult, Python}; // TODO: replace with upstream implementation once // https://github.com/PyO3/pyo3/issues/1813 is resolved @@ -188,7 +188,7 @@ pub mod py { impl TryIntoPy for &'_ T where - T: AsPyPointer, + T: AsRef, { fn try_into_py(self, py: Python) -> PyResult { Ok(self.into_py(py))