commit 3e104ff51954ac1c4cd4d7fb66258872cdf2aec0 from: Jelmer Vernooij via: GitHub date: Mon Apr 01 23:22:54 2024 UTC Merge pull request #1274 from jelmer/bump-pyo3 Bump pyo3 version commit - b0a92ebfa39697d0d2cdbbea619866dac1b1cdf3 commit + 3e104ff51954ac1c4cd4d7fb66258872cdf2aec0 blob - efe8a21a6cab3b6e22678c300d80d45d12ee58a9 blob + 46a40b70659b653e6ee7f4d60f5bb228f9e9232c --- Cargo.lock +++ Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" @@ -41,15 +41,15 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488b [[package]] name = "libc" -version = "0.2.147" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -63,9 +63,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec5 [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -80,9 +80,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "pack-py" @@ -104,9 +104,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", @@ -123,18 +123,18 @@ checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35 [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a02a88a17e74cadbc8ce77855e1d6c8ad0ab82901a4a9b5046bd01c1c0bd95cd" +checksum = "a7a8b1990bd018761768d5e608a13df8bd1ac5f678456e0f301bb93e5f3ea16b" dependencies = [ "cfg-if", "indoc", @@ -150,9 +150,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5eb0b6ecba38961f6f4bd6cd5906dfab3cd426ff37b2eed5771006aa31656f1" +checksum = "650dca34d463b6cdbdb02b1d71bfd6eb6b6816afc708faebb3bac1380ff4aef7" dependencies = [ "once_cell", "target-lexicon", @@ -160,9 +160,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba8a6e48a29b5d22e4fdaf132d8ba8d3203ee9f06362d48f244346902a594ec3" +checksum = "09a7da8fc04a8a2084909b59f29e1b8474decac98b951d77b80b26dc45f046ad" dependencies = [ "libc", "pyo3-build-config", @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e80493c5965f94a747d0782a607b2328a4eea5391327b152b00e2f3b001cede" +checksum = "4b8a199fce11ebb28e3569387228836ea98110e43a804a530a9fd83ade36d513" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -182,9 +182,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcd7d86f42004025200e12a6a8119bd878329e6fddef8178eaafa4e4b5906c5b" +checksum = "93fbbfd7eb553d10036513cb122b888dcd362a945a00b06c165f2ab480d4cc3b" dependencies = [ "heck", "proc-macro2", @@ -195,18 +195,18 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags", ] @@ -219,15 +219,15 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bc [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.32" +version = "2.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" +checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" dependencies = [ "proc-macro2", "quote", @@ -236,15 +236,15 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.11" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unindent" blob - c66a4d73cae96e18ea875e36ac5513a88baddd1f blob + f6716dbeff298ceee3ce4de8b6c98ff8c21d7f00 --- Cargo.toml +++ Cargo.toml @@ -1,2 +1,5 @@ [workspace] members = ["crates/*"] + +[workspace.dependencies] +pyo3 = ">=0.19" blob - 3eaabe4ffd3c8cf8031772ecb534227cb6e5ef23 blob + 9b3a1066ccea2f0f66dca0d5b9aabae36029152d --- crates/diff-tree/Cargo.toml +++ crates/diff-tree/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = ">=0.19", features = ["extension-module"]} +pyo3 = { workspace = true, features = ["extension-module"]} blob - 1b130456fec6a587cc171e2b5a7fdc62ff154e8a blob + c540b662456120cbda6b662562d4f01f36fbbce6 --- crates/diff-tree/src/lib.rs +++ crates/diff-tree/src/lib.rs @@ -21,8 +21,8 @@ use pyo3::prelude::*; +use pyo3::exceptions::PyTypeError; use pyo3::types::{PyBytes, PyList, PyTuple}; -use pyo3::exceptions::{PyTypeError}; use pyo3::Python; use std::cmp::Ordering; @@ -30,12 +30,7 @@ use std::cmp::Ordering; const S_IFMT: u32 = 0o170000; const S_IFDIR: u32 = 0o040000; -fn add_hash( - get: &PyAny, - set: &PyAny, - string: &[u8], - py: Python, -) -> PyResult<()> { +fn add_hash(get: &PyAny, set: &PyAny, string: &[u8], py: Python) -> PyResult<()> { let str_obj = PyBytes::new(py, string); let hash_obj = str_obj.hash()?; let value = get.call1((hash_obj,))?; @@ -55,7 +50,9 @@ fn _count_blocks(py: Python, obj: &PyAny) -> PyResult< let chunks = obj.call_method0("as_raw_chunks")?; if !chunks.is_instance_of::() { - return Err(PyTypeError::new_err("as_raw_chunks() did not return a list")); + return Err(PyTypeError::new_err( + "as_raw_chunks() did not return a list", + )); } let num_chunks = chunks.extract::>()?.len(); @@ -85,7 +82,6 @@ fn _count_blocks(py: Python, obj: &PyAny) -> PyResult< Ok(counts.to_object(py)) } - #[pyfunction] fn _is_tree(_py: Python, entry: &PyAny) -> PyResult { let mode = entry.getattr("mode")?; @@ -98,11 +94,7 @@ fn _is_tree(_py: Python, entry: &PyAny) -> PyResult PyResult> { +fn tree_entries(path: &[u8], tree: &PyAny, py: Python) -> PyResult> { if tree.is_none() { return Ok(Vec::new()); } @@ -110,18 +102,20 @@ fn tree_entries( let dom = py.import("dulwich.objects")?; let tree_entry_cls = dom.getattr("TreeEntry")?; - let items = tree.call_method1("iteritems", (true,))?.extract::>()?; + let items = tree + .call_method1("iteritems", (true,))? + .extract::>()?; let mut result = Vec::new(); for item in items { - let (name, mode, sha) = item.extract::<(&[u8], u32, PyObject)>(py)?; + let (name, mode, sha) = item.extract::<(Vec, u32, PyObject)>(py)?; let mut new_path = Vec::with_capacity(path.len() + name.len() + 1); if !path.is_empty() { new_path.extend_from_slice(path); new_path.push(b'/'); } - new_path.extend_from_slice(name); + new_path.extend_from_slice(name.as_slice()); let tree_entry = tree_entry_cls.call1((PyBytes::new(py, &new_path), mode, sha))?; result.push(tree_entry.to_object(py)); @@ -151,28 +145,22 @@ fn _merge_entries(py: Python, path: &[u8], tree1: &PyA while i1 < entries1.len() && i2 < entries2.len() { let cmp = entry_path_cmp(entries1[i1].as_ref(py), entries2[i2].as_ref(py))?; let (e1, e2) = match cmp { - Ordering::Equal => { - (entries1[i1].clone(), entries2[i2].clone()) - } - Ordering::Less => { - (entries1[i1].clone(), null_entry.clone()) - } - Ordering::Greater => { - (null_entry.clone(), entries2[i2].clone()) - } + Ordering::Equal => (entries1[i1].clone(), entries2[i2].clone()), + Ordering::Less => (entries1[i1].clone(), null_entry.clone()), + Ordering::Greater => (null_entry.clone(), entries2[i2].clone()), }; let pair = PyTuple::new(py, &[e1, e2]); result.push(pair); match cmp { Ordering::Equal => { - i1 += 1; - i2 += 1; + i1 += 1; + i2 += 1; } Ordering::Less => { - i1 += 1; + i1 += 1; } Ordering::Greater => { - i2 += 1; + i2 += 1; } } } blob - 025a4e44e94d6dad31227920ca61ab9502b7faff blob + 2ce9e14b0795477077a65738738d1dcdacd0d673 --- crates/objects/Cargo.toml +++ crates/objects/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = ">=0.19", features = ["extension-module"]} +pyo3 = { workspace = true, features = ["extension-module"]} memchr = "2" blob - dcc2b8db50a66cc5d173e0e317edc206497fa264 blob + 72f8d3b91d124fdb5bb43f628ee5262f825f1ff5 --- crates/pack/Cargo.toml +++ crates/pack/Cargo.toml @@ -7,5 +7,5 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = ">=0.19", features = ["extension-module"]} +pyo3 = { workspace = true, features = ["extension-module"]} memchr = "2"