diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 461d674..b93d06c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: runs-on: "${{ matrix.os }}" steps: - - uses: "actions/checkout@v4" + - uses: "actions/checkout@v5" with: # We need tags to get the correct code version: fetch-depth: 0 @@ -84,7 +84,7 @@ jobs: # IMPORTANT: this permission is mandatory for trusted publishing id-token: write steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v5 with: pattern: Wheels* merge-multiple: true diff --git a/Cargo.toml b/Cargo.toml index a82c268..c2b7fd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ readme = "README.md" license = "Apache 2.0" homepage = "https://github.com/G-Research/ahocorasick_rs" repository = "https://github.com/G-Research/ahocorasick_rs" +resolver = "2" [lib] name = "ahocorasick_rs" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e60b212..357670f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.85.1" +channel = "1.89" components = ["rustfmt", "clippy"] \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 06a1311..96c5233 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -194,7 +194,7 @@ impl PyAhoCorasick { .into_iter() .flat_map(|chunk| { // Release the GIL in case some other thread wants to do work: - py.allow_threads(|| ()); + py.detach(|| ()); chunk.map(|s| s.extract::(py).ok()) }) @@ -234,7 +234,7 @@ impl PyAhoCorasick { let byte_to_code_point = self_.get_byte_to_code_point(haystack); let py = self_.py(); let matches = get_matches(&self_.ac_impl, haystack.as_bytes(), overlapping)?; - py.allow_threads(|| { + py.detach(|| { Ok(matches .map(|m| { ( @@ -257,7 +257,7 @@ impl PyAhoCorasick { ) -> PyResult> { let py = self_.py(); let matches = get_matches(&self_.ac_impl, haystack.as_bytes(), overlapping)?; - let matches = py.allow_threads(|| matches.collect::>().into_iter()); + let matches = py.detach(|| matches.collect::>().into_iter()); let result = match self_.patterns { Some(ref patterns) => { PyList::new(py, matches.map(|m| patterns[m.pattern()].clone_ref(py))) @@ -428,7 +428,7 @@ impl PyBytesAhoCorasick { // However, if the haystack is a PyBytes, it's guaranteed to be immutable, // so the safety caveat doesn't apply, and we can safely release the GIL // while the matches iterator is holding a reference to the haystack. - py.allow_threads(|| Ok(matches.collect())) + py.detach(|| Ok(matches.collect())) } } }