diff -ruN LibCST-1.5.1.orig/native/Cargo.lock LibCST-1.5.1/native/Cargo.lock --- LibCST-1.5.1.orig/native/Cargo.lock 2024-12-04 20:17:13.432066171 +0100 +++ LibCST-1.5.1/native/Cargo.lock 2024-12-04 20:27:52.260091745 +0100 @@ -265,9 +265,9 @@ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -292,15 +292,6 @@ checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" [[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] name = "is-terminal" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -390,16 +381,6 @@ checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] -name = "lock_api" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] name = "log" version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -454,31 +435,6 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi", -] - -[[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -550,15 +506,16 @@ [[package]] name = "pyo3" -version = "0.20.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a89dc7a5850d0e983be1ec2a463a171d20990487c3cfcd68b5363f1ee3d6fe0" +checksum = "831e8e819a138c36e212f3af3fd9eeffed6bf1510a805af35b0edee5ffa59433" dependencies = [ "cfg-if", "indoc", "libc", "memoffset 0.9.0", - "parking_lot", + "once_cell", + "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", @@ -567,9 +524,9 @@ [[package]] name = "pyo3-build-config" -version = "0.20.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07426f0d8fe5a601f26293f300afd1a7b1ed5e78b2a705870c5f30893c5163be" +checksum = "1e8730e591b14492a8945cdff32f089250b05f5accecf74aeddf9e8272ce1fa8" dependencies = [ "once_cell", "target-lexicon", @@ -577,9 +534,9 @@ [[package]] name = "pyo3-ffi" -version = "0.20.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb7dec17e17766b46bca4f1a4215a85006b4c2ecde122076c562dd058da6cf1" +checksum = "5e97e919d2df92eb88ca80a037969f44e5e70356559654962cbb3316d00300c6" dependencies = [ "libc", "pyo3-build-config", @@ -587,9 +544,9 @@ [[package]] name = "pyo3-macros" -version = "0.20.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f738b4e40d50b5711957f142878cfa0f28e054aa0ebdfc3fd137a843f74ed3" +checksum = "eb57983022ad41f9e683a599f2fd13c3664d7063a3ac5714cae4b7bee7d3f206" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -599,12 +556,13 @@ [[package]] name = "pyo3-macros-backend" -version = "0.20.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc910d4851847827daf9d6cdd4a823fbdaab5b8818325c5e97a86da79e8881f" +checksum = "ec480c0c51ddec81019531705acac51bcdbeae563557c982aa8263bb96880372" dependencies = [ "heck", "proc-macro2", + "pyo3-build-config", "quote", "syn 2.0.75", ] @@ -639,15 +597,6 @@ ] [[package]] -name = "redox_syscall" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] name = "regex" version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -752,12 +701,6 @@ ] [[package]] -name = "smallvec" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc88c725d61fc6c3132893370cac4a0200e3fedf5da8331c570664b1987f5ca2" - -[[package]] name = "syn" version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -781,9 +724,9 @@ [[package]] name = "target-lexicon" -version = "0.12.4" +version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" +checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2" [[package]] name = "termcolor" diff -ruN LibCST-1.5.1.orig/native/libcst/Cargo.toml LibCST-1.5.1/native/libcst/Cargo.toml --- LibCST-1.5.1.orig/native/libcst/Cargo.toml 2024-12-04 20:17:13.432066171 +0100 +++ LibCST-1.5.1/native/libcst/Cargo.toml 2024-12-04 20:28:12.206087353 +0100 @@ -36,7 +36,7 @@ [dependencies] paste = "1.0.15" -pyo3 = { version = "0.20", optional = true } +pyo3 = { version = "0.22", optional = true } thiserror = "1.0.63" peg = "0.8.4" chic = "1.2.2" diff -ruN LibCST-1.5.1.orig/native/libcst/src/nodes/expression.rs LibCST-1.5.1/native/libcst/src/nodes/expression.rs --- LibCST-1.5.1.orig/native/libcst/src/nodes/expression.rs 2024-12-04 20:17:13.432066171 +0100 +++ LibCST-1.5.1/native/libcst/src/nodes/expression.rs 2024-12-04 20:18:29.896441583 +0100 @@ -2524,6 +2524,7 @@ #[cfg(feature = "py")] mod py { + use pyo3::types::PyAnyMethods; use pyo3::types::PyModule; use super::*; @@ -2535,7 +2536,7 @@ match self { Self::Starred(s) => s.try_into_py(py), Self::Simple { value, comma } => { - let libcst = PyModule::import(py, "libcst")?; + let libcst = PyModule::import_bound(py, "libcst")?; let kwargs = [ Some(("value", value.try_into_py(py)?)), comma @@ -2547,11 +2548,11 @@ .filter(|x| x.is_some()) .map(|x| x.as_ref().unwrap()) .collect::>() - .into_py_dict(py); + .into_py_dict_bound(py); Ok(libcst .getattr("Element") .expect("no Element found in libcst") - .call((), Some(kwargs))? + .call((), Some(&kwargs))? .into()) } } @@ -2571,7 +2572,7 @@ whitespace_before_colon, .. } => { - let libcst = PyModule::import(py, "libcst")?; + let libcst = PyModule::import_bound(py, "libcst")?; let kwargs = [ Some(("key", key.try_into_py(py)?)), Some(("value", value.try_into_py(py)?)), @@ -2592,11 +2593,11 @@ .filter(|x| x.is_some()) .map(|x| x.as_ref().unwrap()) .collect::>() - .into_py_dict(py); + .into_py_dict_bound(py); Ok(libcst .getattr("DictElement") .expect("no Element found in libcst") - .call((), Some(kwargs))? + .call((), Some(&kwargs))? .into()) } } diff -ruN LibCST-1.5.1.orig/native/libcst/src/nodes/parser_config.rs LibCST-1.5.1/native/libcst/src/nodes/parser_config.rs --- LibCST-1.5.1.orig/native/libcst/src/nodes/parser_config.rs 2024-12-04 20:17:13.432066171 +0100 +++ LibCST-1.5.1/native/libcst/src/nodes/parser_config.rs 2024-12-04 20:18:29.896441583 +0100 @@ -125,7 +125,7 @@ ("version", config.version.clone_ref(py)), ("future_imports", config.future_imports.clone_ref(py)), ] - .into_py_dict(py) + .into_py_dict_bound(py) } pub fn init_module(_py: Python, m: &PyModule) -> PyResult<()> { diff -ruN LibCST-1.5.1.orig/native/libcst/src/nodes/traits.rs LibCST-1.5.1/native/libcst/src/nodes/traits.rs --- LibCST-1.5.1.orig/native/libcst/src/nodes/traits.rs 2024-12-04 20:17:13.432066171 +0100 +++ LibCST-1.5.1/native/libcst/src/nodes/traits.rs 2024-12-04 20:18:29.896441583 +0100 @@ -170,7 +170,7 @@ .map(|x| x.try_into_py(py)) .collect::>>()? .into_iter(); - Ok(PyTuple::new(py, converted).into()) + Ok(PyTuple::new_bound(py, converted).into()) } } diff -ruN LibCST-1.5.1.orig/native/libcst/src/parser/errors.rs LibCST-1.5.1/native/libcst/src/parser/errors.rs --- LibCST-1.5.1.orig/native/libcst/src/parser/errors.rs 2024-12-04 20:17:13.432066171 +0100 +++ LibCST-1.5.1/native/libcst/src/parser/errors.rs 2024-12-04 20:18:29.896441583 +0100 @@ -28,7 +28,7 @@ #[cfg(feature = "py")] mod py_error { - use pyo3::types::{IntoPyDict, PyModule}; + use pyo3::types::{IntoPyDict, PyAnyMethods, PyModule}; use pyo3::{IntoPy, PyErr, PyErrArguments, Python}; use super::ParserError; @@ -65,13 +65,14 @@ ("raw_line", (line + 1).into_py(py)), ("raw_column", col.into_py(py)), ] - .into_py_dict(py); - let libcst = PyModule::import(py, "libcst").expect("libcst cannot be imported"); - PyErr::from_value( + .into_py_dict_bound(py); + let libcst = + PyModule::import_bound(py, "libcst").expect("libcst cannot be imported"); + PyErr::from_value_bound( libcst .getattr("ParserSyntaxError") .expect("ParserSyntaxError not found") - .call((), Some(kwargs)) + .call((), Some(&kwargs)) .expect("failed to instantiate"), ) }) @@ -86,7 +87,7 @@ ("raw_line", self.raw_line.into_py(py)), ("raw_column", self.raw_column.into_py(py)), ] - .into_py_dict(py) + .into_py_dict_bound(py) .into_py(py) } } diff -ruN LibCST-1.5.1.orig/native/libcst/src/py.rs LibCST-1.5.1/native/libcst/src/py.rs --- LibCST-1.5.1.orig/native/libcst/src/py.rs 2024-12-04 20:17:13.432066171 +0100 +++ LibCST-1.5.1/native/libcst/src/py.rs 2024-12-04 20:18:29.896441583 +0100 @@ -8,7 +8,7 @@ #[pymodule] #[pyo3(name = "native")] -pub fn libcst_native(_py: Python, m: &PyModule) -> PyResult<()> { +pub fn libcst_native(_py: Python, m: &Bound) -> PyResult<()> { #[pyfn(m)] fn parse_module(source: String, encoding: Option<&str>) -> PyResult { let m = crate::parse_module(source.as_str(), encoding)?; diff -ruN LibCST-1.5.1.orig/native/libcst_derive/src/into_py.rs LibCST-1.5.1/native/libcst_derive/src/into_py.rs --- LibCST-1.5.1.orig/native/libcst_derive/src/into_py.rs 2024-12-04 20:17:13.436065773 +0100 +++ LibCST-1.5.1/native/libcst_derive/src/into_py.rs 2024-12-04 20:18:29.896441583 +0100 @@ -38,12 +38,14 @@ let kwargs_toks = fields_to_kwargs(&var.fields, true); toks.push(quote! { Self::#varname { #(#fieldnames,)* .. } => { - let libcst = pyo3::types::PyModule::import(py, "libcst")?; + use pyo3::types::PyAnyMethods; + + let libcst = pyo3::types::PyModule::import_bound(py, "libcst")?; let kwargs = #kwargs_toks ; Ok(libcst .getattr(stringify!(#varname)) .expect(stringify!(no #varname found in libcst)) - .call((), Some(kwargs))? + .call((), Some(&kwargs))? .into()) } }) @@ -87,12 +89,13 @@ #[automatically_derived] impl#generics crate::nodes::traits::py::TryIntoPy for #ident #generics { fn try_into_py(self, py: pyo3::Python) -> pyo3::PyResult { - let libcst = pyo3::types::PyModule::import(py, "libcst")?; + use pyo3::types::PyAnyMethods; + let libcst = pyo3::types::PyModule::import_bound(py, "libcst")?; let kwargs = #kwargs_toks ; Ok(libcst .getattr(stringify!(#ident)) .expect(stringify!(no #ident found in libcst)) - .call((), Some(kwargs))? + .call((), Some(&kwargs))? .into()) } } @@ -162,7 +165,7 @@ #(#optional_rust_varnames.map(|x| x.try_into_py(py)).transpose()?.map(|x| (stringify!(#optional_py_varnames), x)),)* }; if empty_kwargs { - quote! { pyo3::types::PyDict::new(py) } + quote! { pyo3::types::PyDict::new_bound(py) } } else { quote! { [ #kwargs_pairs #optional_pairs ] @@ -170,7 +173,7 @@ .filter(|x| x.is_some()) .map(|x| x.as_ref().unwrap()) .collect::>() - .into_py_dict(py) + .into_py_dict_bound(py) } } }