Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-ahocorasick-rs for
openSUSE:Factory checked in at 2025-10-31 16:28:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ahocorasick-rs (Old)
and /work/SRC/openSUSE:Factory/.python-ahocorasick-rs.new.1980 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ahocorasick-rs"
Fri Oct 31 16:28:08 2025 rev:3 rq:1314615 version:1.0.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-ahocorasick-rs/python-ahocorasick-rs.changes
2025-03-24 13:32:07.511508550 +0100
+++
/work/SRC/openSUSE:Factory/.python-ahocorasick-rs.new.1980/python-ahocorasick-rs.changes
2025-10-31 16:28:51.967944964 +0100
@@ -1,0 +2,8 @@
+Thu Oct 30 23:58:17 UTC 2025 - Steve Kowalik <[email protected]>
+
+- Update to 1.0.3:
+ * Add description on PyPI
+ * Hopefully show more metadata in PyPI
+ * Guaranteed API stability, and Python 3.14 support.
+
+-------------------------------------------------------------------
Old:
----
ahocorasick_rs-0.22.2.tar.gz
New:
----
ahocorasick_rs-1.0.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-ahocorasick-rs.spec ++++++
--- /var/tmp/diff_new_pack.z3wQeM/_old 2025-10-31 16:28:53.119993913 +0100
+++ /var/tmp/diff_new_pack.z3wQeM/_new 2025-10-31 16:28:53.119993913 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-ahocorasick-rs
#
-# Copyright (c) 2025 SUSE LLC
+# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: python-ahocorasick-rs
-Version: 0.22.2
+Version: 1.0.3
Release: 0
Summary: Search a string for multiple substrings at once
License: Apache-2.0
@@ -26,18 +26,17 @@
Source1: vendor.tar.zst
BuildRequires: %{python_module maturin >= 1.0}
BuildRequires: %{python_module pip}
-BuildRequires: cargo
+BuildRequires: cargo-packaging
BuildRequires: python-rpm-macros
BuildRequires: zstd
# SECTION test requirements
-BuildRequires: %{python_module typing_extensions >= 4.6.0}
+BuildRequires: %{python_module typing_extensions >= 4.6.0 if %python-base <
3.12}
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module pyahocorasick}
BuildRequires: %{python_module pytest-benchmark}
BuildRequires: %{python_module pytest}
# /SECTION
BuildRequires: fdupes
-Requires: python-typing_extensions >= 4.6.0
%python_subpackages
%description
++++++ _service ++++++
--- /var/tmp/diff_new_pack.z3wQeM/_old 2025-10-31 16:28:53.155995443 +0100
+++ /var/tmp/diff_new_pack.z3wQeM/_new 2025-10-31 16:28:53.155995443 +0100
@@ -1,7 +1,7 @@
<services>
<service name="download_files" mode="manual"/>
<service name="cargo_vendor" mode="manual">
- <param name="srcdir">ahocorasick_rs-0.22.2</param>
+ <param name="srctar">ahocorasick_rs-1.0.3.tar.gz</param>
<param name="compression">zst</param>
</service>
<service name="cargo_audit" mode="manual">
++++++ ahocorasick_rs-0.22.2.tar.gz -> ahocorasick_rs-1.0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/.github/workflows/main.yml
new/ahocorasick_rs-1.0.3/.github/workflows/main.yml
--- old/ahocorasick_rs-0.22.2/.github/workflows/main.yml 2025-02-06
16:40:17.000000000 +0100
+++ new/ahocorasick_rs-1.0.3/.github/workflows/main.yml 2025-10-08
17:33:00.000000000 +0200
@@ -13,7 +13,7 @@
env:
# Give nice tracebacks on segfaults.
PYTHONFAULTHANDLER: "true"
- MATURIN_VERSION: "1.7.0"
+ MATURIN_VERSION: "1.9.6"
jobs:
@@ -21,19 +21,19 @@
name: "${{ matrix.os }}: Python ${{ matrix.python-version }}"
strategy:
matrix:
- python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
- os: ["ubuntu-latest", "macos-13", "windows-latest"]
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
+ os: ["ubuntu-latest", "macos-13", "windows-latest", "ubuntu-24.04-arm"]
env:
MATURIN_EXTRA: ""
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
- - uses: "actions/setup-python@v5"
+ - uses: "actions/setup-python@v6"
with:
python-version: "${{ matrix.python-version }}"
- uses: "dtolnay/rust-toolchain@stable"
@@ -76,38 +76,15 @@
name: "Wheels-tarball"
path: target/wheels/ahocorasick*.tar.gz
- cross:
- runs-on: ubuntu-latest
- strategy:
- matrix:
- python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-python@v5
- with:
- python-version: ${{ matrix.python-version }}
- - name: Build wheels
- uses: messense/maturin-action@v1
- with:
- maturin-version: "${{ env.MATURIN_VERSION }}"
- target: aarch64-unknown-linux-gnu
- manylinux: auto
- args: --release --out target/wheels/ -i python${{
matrix.python-version }}
- - name: Archive production artifacts
- uses: actions/upload-artifact@v4
- with:
- name: "Wheels-${{ matrix.python-version}}-arm64-cross"
- path: target/wheels/*.whl
-
publish:
- needs: ['cross', 'tests']
+ needs: ['tests']
environment: 'release'
runs-on: ubuntu-latest
permissions:
# 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/ahocorasick_rs-0.22.2/.hypothesis/constants/6c7b896ae53cb483
new/ahocorasick_rs-1.0.3/.hypothesis/constants/6c7b896ae53cb483
--- old/ahocorasick_rs-0.22.2/.hypothesis/constants/6c7b896ae53cb483
1970-01-01 01:00:00.000000000 +0100
+++ new/ahocorasick_rs-1.0.3/.hypothesis/constants/6c7b896ae53cb483
2025-10-08 17:33:43.000000000 +0200
@@ -0,0 +1,4 @@
+# file: /opt/hostedtoolcache/Python/3.13.7/x64/bin/pytest
+# hypothesis_version: 6.140.3
+
+['.exe', '__main__']
\ No newline at end of file
Binary files
old/ahocorasick_rs-0.22.2/.hypothesis/unicode_data/15.1.0/charmap.json.gz and
new/ahocorasick_rs-1.0.3/.hypothesis/unicode_data/15.1.0/charmap.json.gz differ
Binary files
old/ahocorasick_rs-0.22.2/.hypothesis/unicode_data/15.1.0/codec-utf-8.json.gz
and
new/ahocorasick_rs-1.0.3/.hypothesis/unicode_data/15.1.0/codec-utf-8.json.gz
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/CHANGELOG.md
new/ahocorasick_rs-1.0.3/CHANGELOG.md
--- old/ahocorasick_rs-0.22.2/CHANGELOG.md 2025-02-06 16:40:17.000000000
+0100
+++ new/ahocorasick_rs-1.0.3/CHANGELOG.md 2025-10-08 17:33:00.000000000
+0200
@@ -1,5 +1,12 @@
# Changelog
+## 1.0
+
+* Added support for Python 3.14 and free-threaded Python.
+* In order to support free-threaded Python, move the burden of thread safety
onto users.
+ Specifically: you must not mutate byte arrays and the like that are passed
to `BytesAhoCorasick` APIs while those APIs are running.
+* Dropped support for Python 3.9.
+
## 0.22.2
* Update Rust dependencies.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/Cargo.lock
new/ahocorasick_rs-1.0.3/Cargo.lock
--- old/ahocorasick_rs-0.22.2/Cargo.lock 2025-02-06 16:40:17.000000000
+0100
+++ new/ahocorasick_rs-1.0.3/Cargo.lock 2025-10-08 17:33:00.000000000 +0200
@@ -13,7 +13,7 @@
[[package]]
name = "ahocorasick_rs"
-version = "0.22.2"
+version = "1.0.3"
dependencies = [
"aho-corasick",
"itertools",
@@ -22,21 +22,15 @@
[[package]]
name = "autocfg"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "either"
-version = "1.13.0"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "heck"
@@ -46,9 +40,9 @@
[[package]]
name = "indoc"
-version = "2.0.5"
+version = "2.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
+checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
[[package]]
name = "itertools"
@@ -61,15 +55,15 @@
[[package]]
name = "libc"
-version = "0.2.169"
+version = "0.2.176"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
+checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174"
[[package]]
name = "memchr"
-version = "2.7.4"
+version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
name = "memoffset"
@@ -82,32 +76,31 @@
[[package]]
name = "once_cell"
-version = "1.20.2"
+version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "portable-atomic"
-version = "1.10.0"
+version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
+checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
[[package]]
name = "proc-macro2"
-version = "1.0.93"
+version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
+checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
"unicode-ident",
]
[[package]]
name = "pyo3"
-version = "0.23.4"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57fe09249128b3173d092de9523eaa75136bf7ba85e0d69eca241c7939c933cc"
+checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
dependencies = [
- "cfg-if",
"indoc",
"libc",
"memoffset",
@@ -121,19 +114,18 @@
[[package]]
name = "pyo3-build-config"
-version = "0.23.4"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1cd3927b5a78757a0d71aa9dff669f903b1eb64b54142a9bd9f757f8fde65fd7"
+checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
dependencies = [
- "once_cell",
"target-lexicon",
]
[[package]]
name = "pyo3-ffi"
-version = "0.23.4"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dab6bb2102bd8f991e7749f130a70d05dd557613e39ed2deeee8e9ca0c4d548d"
+checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
dependencies = [
"libc",
"pyo3-build-config",
@@ -141,9 +133,9 @@
[[package]]
name = "pyo3-macros"
-version = "0.23.4"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91871864b353fd5ffcb3f91f2f703a22a9797c91b9ab497b1acac7b07ae509c7"
+checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
dependencies = [
"proc-macro2",
"pyo3-macros-backend",
@@ -153,9 +145,9 @@
[[package]]
name = "pyo3-macros-backend"
-version = "0.23.4"
+version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43abc3b80bc20f3facd86cd3c60beed58c3e2aa26213f3cda368de39c60a27e4"
+checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
dependencies = [
"heck",
"proc-macro2",
@@ -166,18 +158,18 @@
[[package]]
name = "quote"
-version = "1.0.38"
+version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
+checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
-version = "2.0.98"
+version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
+checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [
"proc-macro2",
"quote",
@@ -186,18 +178,18 @@
[[package]]
name = "target-lexicon"
-version = "0.12.16"
+version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
+checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c"
[[package]]
name = "unicode-ident"
-version = "1.0.16"
+version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034"
+checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
[[package]]
name = "unindent"
-version = "0.2.3"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
+checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/Cargo.toml
new/ahocorasick_rs-1.0.3/Cargo.toml
--- old/ahocorasick_rs-0.22.2/Cargo.toml 1970-01-01 01:00:00.000000000
+0100
+++ new/ahocorasick_rs-1.0.3/Cargo.toml 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +1,14 @@
[package]
name = "ahocorasick_rs"
-version = "0.22.2"
-edition = "2021"
+version = "1.0.3"
+edition = "2024"
authors = ["G-Research <[email protected]>", "Itamar Turner-Trauring
<[email protected]>"]
description = "Search a string for multiple substrings at once"
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"
@@ -16,7 +17,7 @@
[dependencies]
aho-corasick = "1"
itertools = "0.14.0"
-pyo3 = { version = "0.23", features = ["py-clone"] }
+pyo3 = { version = "0.26", features = ["py-clone"] }
[features]
# The extension-module song and dance is explained here:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/PKG-INFO
new/ahocorasick_rs-1.0.3/PKG-INFO
--- old/ahocorasick_rs-0.22.2/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
+++ new/ahocorasick_rs-1.0.3/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +1,13 @@
-Metadata-Version: 2.3
+Metadata-Version: 2.4
Name: ahocorasick_rs
-Version: 0.22.2
-Requires-Dist: typing-extensions >=4.6.0 ; python_version < '3.12'
+Version: 1.0.3
+Requires-Dist: typing-extensions>=4.6.0 ; python_full_version < '3.12'
License-File: LICENSE
-Summary: Search a string for multiple substrings at once
+Summary: Search for multiple substrings at the same time, and quickly too
Home-Page: https://github.com/G-Research/ahocorasick_rs
-Author: G-Research <[email protected]>, Itamar Turner-Trauring
<[email protected]>
-Author-email: G-Research <[email protected]>, Itamar Turner-Trauring
<[email protected]>
License: Apache 2.0
-Requires-Python: >=3.8
-Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
-Project-URL: Source Code, https://github.com/G-Research/ahocorasick_rs
+Requires-Python: >=3.10
+Description-Content-Type: text/markdown
# ahocorasick_rs: Quickly search for multiple substrings at once
@@ -78,6 +75,9 @@
You can also search `bytes`, `bytearray`, `memoryview`, and other objects
supporting the Python buffer API.
+> **IMPORTANT:** If you are searching mutable buffer, you **must not mutate it
in another thread** while `find_matches_as_indexes()` is running.
+> Similarly, the patterns cannot be mutated while the `BytesAhoCorasick`
object is being constructed.
+
```python
>>> patterns = [b"hello", b"world"]
>>> ac = ahocorasick_rs.BytesAhoCorasick(patterns)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/README.md
new/ahocorasick_rs-1.0.3/README.md
--- old/ahocorasick_rs-0.22.2/README.md 2025-02-06 16:40:17.000000000 +0100
+++ new/ahocorasick_rs-1.0.3/README.md 2025-10-08 17:33:00.000000000 +0200
@@ -64,6 +64,9 @@
You can also search `bytes`, `bytearray`, `memoryview`, and other objects
supporting the Python buffer API.
+> **IMPORTANT:** If you are searching mutable buffer, you **must not mutate it
in another thread** while `find_matches_as_indexes()` is running.
+> Similarly, the patterns cannot be mutated while the `BytesAhoCorasick`
object is being constructed.
+
```python
>>> patterns = [b"hello", b"world"]
>>> ac = ahocorasick_rs.BytesAhoCorasick(patterns)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/RELEASE.md
new/ahocorasick_rs-1.0.3/RELEASE.md
--- old/ahocorasick_rs-0.22.2/RELEASE.md 2025-02-06 16:40:17.000000000
+0100
+++ new/ahocorasick_rs-1.0.3/RELEASE.md 2025-10-08 17:33:00.000000000 +0200
@@ -1,6 +1,6 @@
# Release process
-1. Update version in Cargo.toml, commit and push.
-2. Tag release in GitHub.
-3. Download wheels.
-4. Upload wheels to PyPI.
+1. Update version in `Cargo.toml`.
+2. `cargo check` to update `Cargo.lock`.
+3. Commit and push.
+4. Tag release in GitHub.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/pyproject.toml
new/ahocorasick_rs-1.0.3/pyproject.toml
--- old/ahocorasick_rs-0.22.2/pyproject.toml 2025-02-06 16:40:17.000000000
+0100
+++ new/ahocorasick_rs-1.0.3/pyproject.toml 2025-10-08 17:33:00.000000000
+0200
@@ -4,11 +4,14 @@
[project]
name = "ahocorasick_rs"
-requires-python = ">=3.8"
+requires-python = ">=3.10"
+description = "Search for multiple substrings at the same time, and quickly
too"
dependencies = [
# Technically not necessary to run, only needed for type checking...
"typing_extensions >= 4.6.0 ; python_version < '3.12'"
]
+readme = { file = "README.md", content-type = "text/markdown" }
+dynamic = ["version", "license", "home_page", "project_url"]
[tool.maturin]
python-source = "pysrc/"
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/rust-toolchain.toml
new/ahocorasick_rs-1.0.3/rust-toolchain.toml
--- old/ahocorasick_rs-0.22.2/rust-toolchain.toml 2025-02-06
16:40:17.000000000 +0100
+++ new/ahocorasick_rs-1.0.3/rust-toolchain.toml 2025-10-08
17:33:00.000000000 +0200
@@ -1,3 +1,3 @@
[toolchain]
-channel = "1.84.1"
+channel = "1.90"
components = ["rustfmt", "clippy"]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/src/lib.rs
new/ahocorasick_rs-1.0.3/src/lib.rs
--- old/ahocorasick_rs-0.22.2/src/lib.rs 2025-02-06 16:40:17.000000000
+0100
+++ new/ahocorasick_rs-1.0.3/src/lib.rs 2025-10-08 17:33:00.000000000 +0200
@@ -8,7 +8,7 @@
buffer::{PyBuffer, ReadOnlyCell},
exceptions::{PyTypeError, PyValueError},
prelude::*,
- types::{PyBytes, PyList, PyString},
+ types::{PyList, PyString},
};
/// Search for multiple pattern strings against a single haystack string.
@@ -143,35 +143,38 @@
let patterns_error: Cell<Option<PyErr>> = Cell::new(None);
// Convert the `patterns` iterable into an Iterator over Py<PyString>:
- let mut patterns_iter = patterns.iter()?.map_while(|pat| {
- pat.and_then(|i|
i.downcast_into::<PyString>().map_err(PyErr::from).map(|i|i.into_py(py)))
- .map_or_else(
- |e| {
- patterns_error.set(Some(e));
- None
- },
- Some::<Py<PyString>>,
- )
+ let mut patterns_iter = patterns.try_iter()?.map_while(|pat| {
+ pat.and_then(|i| {
+ i.downcast_into::<PyString>()
+ .map_err(PyErr::from)
+ .map(|i| i.unbind())
+ })
+ .map_or_else(
+ |e| {
+ patterns_error.set(Some(e));
+ None
+ },
+ Some::<Py<PyString>>,
+ )
});
// If store_patterns is None (the default), use a heuristic to decide
// whether to store patterns.
let mut patterns: Vec<Py<PyString>> = vec![];
- let store_patterns = store_patterns
- .unwrap_or_else(|| {
- let mut total = 0;
- let mut store_patterns = true;
- for s in patterns_iter.by_ref() {
- // Highly unlikely that strings will fail to return
length, so just expect().
- total += s.bind(py).len().expect("String doesn't have
length?");
- patterns.push(s);
- if total > 4096 {
- store_patterns = false;
- break;
- }
+ let store_patterns = store_patterns.unwrap_or_else(|| {
+ let mut total = 0;
+ let mut store_patterns = true;
+ for s in patterns_iter.by_ref() {
+ // Highly unlikely that strings will fail to return length, so
just expect().
+ total += s.bind(py).len().expect("String doesn't have
length?");
+ patterns.push(s);
+ if total > 4096 {
+ store_patterns = false;
+ break;
}
- store_patterns
- });
+ }
+ store_patterns
+ });
if store_patterns {
for s in patterns_iter.by_ref() {
@@ -183,14 +186,15 @@
.kind(implementation.map(|i| i.into()))
.match_kind(matchkind.into())
.build(
- patterns.clone()
+ patterns
+ .clone()
.into_iter()
.chain(patterns_iter)
.chunks(10 * 1024)
.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())
})
@@ -230,7 +234,7 @@
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| {
(
@@ -246,23 +250,24 @@
/// Return matches as list of patterns (i.e. strings). If ``overlapping``
is
/// ``False`` (the default), don't include overlapping results.
#[pyo3(signature = (haystack, overlapping = false))]
- fn find_matches_as_strings(
- self_: PyRef<Self>,
- haystack: &str,
+ fn find_matches_as_strings<'py>(
+ self_: PyRef<'py, Self>,
+ haystack: &'py str,
overlapping: bool,
- ) -> PyResult<Py<PyList>> {
+ ) -> 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 result = if let Some(ref patterns) = self_.patterns {
- PyList::new_bound(py, matches.map(|m|
patterns[m.pattern()].clone_ref(py)))
- } else {
- PyList::new_bound(
+ let matches = py.detach(|| matches.collect::<Vec<_>>().into_iter());
+
+ match self_.patterns {
+ Some(ref patterns) => {
+ PyList::new(py, matches.map(|m|
patterns[m.pattern()].clone_ref(py)))
+ }
+ _ => PyList::new(
py,
- matches.map(|m| PyString::new_bound(py,
&haystack[m.start()..m.end()])),
- )
- };
- Ok(result.into())
+ matches.map(|m| PyString::new(py,
&haystack[m.start()..m.end()])),
+ ),
+ }
}
}
@@ -277,7 +282,7 @@
// Get a PyBufferBytes from a Python object
fn try_from(obj: Bound<'py, PyAny>) -> PyResult<Self> {
- let buffer = PyBuffer::<u8>::get_bound(&obj).map_err(PyErr::from)?;
+ let buffer = PyBuffer::<u8>::get(&obj)?;
if buffer.dimensions() > 1 {
return Err(PyTypeError::new_err(
@@ -323,10 +328,12 @@
// wouldn't be able to prevent calling back into Python while holding
// this reference, which might also result in a mutation).
//
- // This effectively means that it's only safe to hold onto the
reference
- // returned from this function as long as we don't release the GIL and
- // don't call back into Python code while the reference is alive.
- // See also https://github.com/PyO3/pyo3/issues/2824
+ // In addition, in a free-threaded world there is no GIL at all to
+ // prevent mutation.
+ //
+ // Following the lead of `pyo3-numpy`, we deal with this by documenting
+ // to the user that the buffer cannot be mutated while it is passed to
+ // our API. See also https://github.com/PyO3/pyo3/issues/2824
unsafe { std::mem::transmute(slice) }
}
}
@@ -343,6 +350,12 @@
/// finished.
/// * ``matchkind``: Defaults to ``"MATCHKING_STANDARD"``.
/// * ``implementation``: The underlying type of automaton to use for
Aho-Corasick.
+///
+/// IMPORTANT: If you are passing in patterns that are mutable buffers, you
MUST
+/// NOT mutate then in another thread while constructing this object. Doing so
+/// will result in undefined behavior. Once the ``BytesAhoCorasick`` object is
+/// constructed, however, they can be mutated since no references will be kept
+/// to them.
#[pyclass(name = "BytesAhoCorasick")]
struct PyBytesAhoCorasick {
ac_impl: AhoCorasick,
@@ -366,7 +379,7 @@
// Convert the `patterns` iterable into an Iterator over PyBufferBytes
let patterns_iter =
patterns
- .iter()?
+ .try_iter()?
.map_while(|pat| match pat.and_then(PyBufferBytes::try_from) {
Ok(pat) => {
if pat.as_ref().is_empty() {
@@ -401,35 +414,27 @@
/// Return matches as tuple of (index_into_patterns,
/// start_index_in_haystack, end_index_in_haystack). If ``overlapping`` is
/// ``False`` (the default), don't include overlapping results.
+ ///
+ /// IMPORTANT: If you are passing in a mutable buffer, you MUST NOT mutate
+ /// it in another thread while this API is running. Doing so will result in
+ /// undefined behavior.
#[pyo3(signature = (haystack, overlapping = false))]
fn find_matches_as_indexes(
self_: PyRef<Self>,
haystack: Bound<'_, PyAny>,
overlapping: bool,
) -> PyResult<Vec<(u64, usize, usize)>> {
- let is_bytes = haystack.is_instance_of::<PyBytes>();
let py = haystack.py();
let haystack_buffer = PyBufferBytes::try_from(haystack)?;
let matches = get_matches(&self_.ac_impl, haystack_buffer.as_ref(),
overlapping)?
.map(|m| (m.pattern().as_u64(), m.start(), m.end()));
- if !is_bytes {
- // Note: we must collect here and not release the GIL or return an
iterator
- // from this function due to the safety caveat in the
implementation of
- // AsRef<[u8]> for PyBufferBytes, which is relevant here since the
matches
- // iterator is holding an AsRef reference to the haystack.
- Ok(matches.collect())
- } else {
- // 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()))
}
}
/// The main Python module.
-#[pymodule]
+#[pymodule(gil_used = false)]
fn ahocorasick_rs(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<PyMatchKind>()?;
m.add_class::<Implementation>()?;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ahocorasick_rs-0.22.2/tests/test_ac_bytes.py
new/ahocorasick_rs-1.0.3/tests/test_ac_bytes.py
--- old/ahocorasick_rs-0.22.2/tests/test_ac_bytes.py 2025-02-06
16:40:17.000000000 +0100
+++ new/ahocorasick_rs-1.0.3/tests/test_ac_bytes.py 2025-10-08
17:33:00.000000000 +0200
@@ -61,7 +61,7 @@
"""
haystack = b"hello, world, hello again"
patterns = [memoryview(b"hello"), bytearray(b"world")]
- ac = BytesAhoCorasick(patterns, implementation=implementation)
+ ac = BytesAhoCorasick(patterns, implementation=implementation) # type:
ignore
expected = [b"hello", b"world", b"hello"]
++++++ vendor.tar.zst ++++++
++++ 813055 lines of diff (skipped)