Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.85.1"
channel = "1.89"
components = ["rustfmt", "clippy"]
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<String>(py).ok())
})
Expand Down Expand Up @@ -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| {
(
Expand All @@ -257,7 +257,7 @@ impl PyAhoCorasick {
) -> PyResult<Bound<'py, PyList>> {
let py = self_.py();
let matches = get_matches(&self_.ac_impl, haystack.as_bytes(), overlapping)?;
let matches = py.allow_threads(|| matches.collect::<Vec<_>>().into_iter());
let matches = py.detach(|| matches.collect::<Vec<_>>().into_iter());
let result = match self_.patterns {
Some(ref patterns) => {
PyList::new(py, matches.map(|m| patterns[m.pattern()].clone_ref(py)))
Expand Down Expand Up @@ -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()))
}
}
}
Expand Down
Loading