PyPcre 0.2.13__tar.gz → 0.2.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypcre-0.2.13 → pypcre-0.2.14}/PKG-INFO +2 -1
- {pypcre-0.2.13 → pypcre-0.2.14}/PyPcre.egg-info/PKG-INFO +2 -1
- {pypcre-0.2.13 → pypcre-0.2.14}/PyPcre.egg-info/SOURCES.txt +1 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/README.md +1 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre/__init__.py +2 -0
- pypcre-0.2.14/pcre/_stdlib_re.py +28 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre/pcre.py +3 -6
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre/re_compat.py +2 -4
- {pypcre-0.2.13 → pypcre-0.2.14}/pyproject.toml +1 -1
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_api_parity.py +9 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_core.py +30 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/LICENSE +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/MANIFEST.in +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/PyPcre.egg-info/dependency_links.txt +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/PyPcre.egg-info/top_level.txt +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre/cache.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre/error.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre/flags.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre/threads.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/atomic_compat.h +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/cache.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/error.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/flag.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/jit_support.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/memory.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/pattern_cache.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/pcre2.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/pcre2.h +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/pcre2_module.h +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/string_helpers.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/pcre_ext/util.c +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/setup.cfg +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/setup.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/setup_utils.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_accuracy.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_basic.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_bench_string.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_benchmark.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_bytes.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_cache.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_clobber.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_clobber_thread.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_errors.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_flags.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_jit.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_memory.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_module.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_pattern.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_setup_utils_multiarch.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_simd.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_threaded_backend.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_transformers_regex.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_utf8.py +0 -0
- {pypcre-0.2.13 → pypcre-0.2.14}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyPcre
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Modern, GIL-friendly, Fast Python bindings for PCRE2 with auto caching and JIT of compiled patterns.
|
|
5
5
|
Author-email: ModelCloud <qubitium@modelcloud.ai>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -43,6 +43,7 @@ Modern `nogil` Python bindings for the Pcre2 library with `stdlib.re` api compat
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
## Latest News
|
|
46
|
+
* 03/21/2026 [0.2.14](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.4): Python 3.14 compat
|
|
46
47
|
* 03/02/2026 [0.2.11](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.11): Auto-detect `Visual Studio` for `Windows` env during install/compile.
|
|
47
48
|
* 02/24/2026 [0.2.10](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.10): Allow VisualStudio (VS) compiler version check override via env var.
|
|
48
49
|
* 12/15/2025 [0.2.8](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.8): Fixed multi-arch Linux os compatibility where both x86_64 and i386 libs of pcre2 are installed.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyPcre
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.14
|
|
4
4
|
Summary: Modern, GIL-friendly, Fast Python bindings for PCRE2 with auto caching and JIT of compiled patterns.
|
|
5
5
|
Author-email: ModelCloud <qubitium@modelcloud.ai>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -43,6 +43,7 @@ Modern `nogil` Python bindings for the Pcre2 library with `stdlib.re` api compat
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
## Latest News
|
|
46
|
+
* 03/21/2026 [0.2.14](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.4): Python 3.14 compat
|
|
46
47
|
* 03/02/2026 [0.2.11](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.11): Auto-detect `Visual Studio` for `Windows` env during install/compile.
|
|
47
48
|
* 02/24/2026 [0.2.10](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.10): Allow VisualStudio (VS) compiler version check override via env var.
|
|
48
49
|
* 12/15/2025 [0.2.8](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.8): Fixed multi-arch Linux os compatibility where both x86_64 and i386 libs of pcre2 are installed.
|
|
@@ -20,6 +20,7 @@ Modern `nogil` Python bindings for the Pcre2 library with `stdlib.re` api compat
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
## Latest News
|
|
23
|
+
* 03/21/2026 [0.2.14](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.4): Python 3.14 compat
|
|
23
24
|
* 03/02/2026 [0.2.11](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.11): Auto-detect `Visual Studio` for `Windows` env during install/compile.
|
|
24
25
|
* 02/24/2026 [0.2.10](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.10): Allow VisualStudio (VS) compiler version check override via env var.
|
|
25
26
|
* 12/15/2025 [0.2.8](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.8): Fixed multi-arch Linux os compatibility where both x86_64 and i386 libs of pcre2 are installed.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Compatibility helpers for private stdlib :mod:`re` internals."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re as _std_re
|
|
6
|
+
import warnings
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _load_parser():
|
|
10
|
+
parser = getattr(_std_re, "_parser", None)
|
|
11
|
+
if parser is not None:
|
|
12
|
+
return parser
|
|
13
|
+
|
|
14
|
+
with warnings.catch_warnings():
|
|
15
|
+
warnings.simplefilter("ignore", DeprecationWarning)
|
|
16
|
+
import sre_parse as parser
|
|
17
|
+
|
|
18
|
+
return parser
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
_parser = _load_parser()
|
|
22
|
+
|
|
23
|
+
RE_TEMPLATE = getattr(_std_re, "TEMPLATE", 0)
|
|
24
|
+
RE_TEMPLATE_FLAG: int = int(getattr(_std_re, "TEMPLATE", 0))
|
|
25
|
+
RE_UNICODE_FLAG: int = int(getattr(_std_re, "UNICODE", 0))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
__all__ = ["_parser", "RE_TEMPLATE", "RE_TEMPLATE_FLAG", "RE_UNICODE_FLAG"]
|
|
@@ -9,14 +9,11 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
import re as _std_re
|
|
11
11
|
from collections.abc import Generator, Iterable
|
|
12
|
-
try:
|
|
13
|
-
from re import _parser, TEMPLATE # python 3.11+
|
|
14
|
-
except Exception:
|
|
15
|
-
import sre_parse as _parser
|
|
16
12
|
from typing import Any, List
|
|
17
13
|
|
|
18
14
|
import pcre_ext_c as _pcre2
|
|
19
15
|
|
|
16
|
+
from ._stdlib_re import RE_TEMPLATE, RE_TEMPLATE_FLAG, RE_UNICODE_FLAG, _parser
|
|
20
17
|
from .cache import cached_compile
|
|
21
18
|
from .cache import clear_cache as _clear_cache
|
|
22
19
|
from .flags import Flag, strip_py_only_flags
|
|
@@ -128,7 +125,7 @@ def _apply_default_unicode_flags(pattern: Any, flags: int) -> int:
|
|
|
128
125
|
|
|
129
126
|
|
|
130
127
|
def _coerce_stdlib_regexflag(flag: _std_re.RegexFlag) -> int:
|
|
131
|
-
unsupported_bits = int(flag) & ~_STD_RE_FLAG_MASK
|
|
128
|
+
unsupported_bits = int(flag) & ~(_STD_RE_FLAG_MASK | RE_TEMPLATE_FLAG | RE_UNICODE_FLAG)
|
|
132
129
|
if unsupported_bits:
|
|
133
130
|
unsupported = _std_re.RegexFlag(unsupported_bits)
|
|
134
131
|
raise ValueError(
|
|
@@ -618,7 +615,7 @@ def template(pattern, flags=0):
|
|
|
618
615
|
"without an obvious purpose. "
|
|
619
616
|
"Use re.compile() instead.",
|
|
620
617
|
DeprecationWarning)
|
|
621
|
-
return compile(pattern, flags |
|
|
618
|
+
return compile(pattern, flags | RE_TEMPLATE)
|
|
622
619
|
|
|
623
620
|
_PARALLEL_EXEC_METHODS = frozenset({"match", "search", "fullmatch", "findall"})
|
|
624
621
|
|
|
@@ -9,14 +9,12 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
import operator
|
|
11
11
|
import re as _std_re
|
|
12
|
-
try:
|
|
13
|
-
from re import _parser # python 3.11+
|
|
14
|
-
except Exception:
|
|
15
|
-
import sre_parse as _parser
|
|
16
12
|
from typing import Any, List
|
|
17
13
|
|
|
18
14
|
import pcre_ext_c as _pcre2
|
|
19
15
|
|
|
16
|
+
from ._stdlib_re import _parser
|
|
17
|
+
|
|
20
18
|
|
|
21
19
|
_CRawMatch = _pcre2.Match
|
|
22
20
|
|
|
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "PyPcre"
|
|
12
|
-
version = "0.2.
|
|
12
|
+
version = "0.2.14"
|
|
13
13
|
description = "Modern, GIL-friendly, Fast Python bindings for PCRE2 with auto caching and JIT of compiled patterns."
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.9"
|
|
@@ -51,6 +51,8 @@ def test_stdlib_style_flag_aliases():
|
|
|
51
51
|
assert pcre.A == ascii_alias
|
|
52
52
|
assert pcre.UNICODE == 0
|
|
53
53
|
assert pcre.U == 0
|
|
54
|
+
assert pcre.TEMPLATE == 0
|
|
55
|
+
assert pcre.T == 0
|
|
54
56
|
|
|
55
57
|
|
|
56
58
|
def test_specific_compile_error_exposes_dedicated_exception():
|
|
@@ -83,6 +85,13 @@ def test_compile_accepts_stdlib_regex_flags():
|
|
|
83
85
|
assert combo.flags & Flag.MULTILINE
|
|
84
86
|
|
|
85
87
|
|
|
88
|
+
def test_compile_accepts_noop_stdlib_regex_flags():
|
|
89
|
+
compiled = pcre.compile(r"pattern", flags=re.RegexFlag.UNICODE)
|
|
90
|
+
assert isinstance(compiled, pcre.Pattern)
|
|
91
|
+
assert compiled.flags & Flag.UTF
|
|
92
|
+
assert compiled.flags & Flag.UCP
|
|
93
|
+
|
|
94
|
+
|
|
86
95
|
def test_compile_rejects_incompatible_stdlib_regex_flags():
|
|
87
96
|
with pytest.raises(ValueError):
|
|
88
97
|
pcre.compile(r"pattern", flags=re.RegexFlag.DEBUG)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import types
|
|
2
2
|
from collections import OrderedDict
|
|
3
|
+
import re
|
|
3
4
|
|
|
4
5
|
import pytest
|
|
5
6
|
from pcre import Flag
|
|
@@ -288,6 +289,35 @@ def test_compile_rejects_non_int_iterable_flags():
|
|
|
288
289
|
core.compile("expr", flags=("not", "ints"))
|
|
289
290
|
|
|
290
291
|
|
|
292
|
+
def test_template_delegates_to_compile_without_template_bits(monkeypatch):
|
|
293
|
+
captured = {}
|
|
294
|
+
|
|
295
|
+
def fake_cached(pattern, flags, wrapper, *, jit):
|
|
296
|
+
captured["flags"] = flags
|
|
297
|
+
fake_cpattern = types.SimpleNamespace(
|
|
298
|
+
pattern=pattern,
|
|
299
|
+
groupindex={},
|
|
300
|
+
flags=flags,
|
|
301
|
+
match=MethodRecorder("match"),
|
|
302
|
+
search=MethodRecorder("search"),
|
|
303
|
+
fullmatch=MethodRecorder("fullmatch"),
|
|
304
|
+
jit=jit,
|
|
305
|
+
)
|
|
306
|
+
return wrapper(fake_cpattern)
|
|
307
|
+
|
|
308
|
+
monkeypatch.setattr(core, "cached_compile", fake_cached)
|
|
309
|
+
monkeypatch.setattr(core, "RE_TEMPLATE", re.RegexFlag.UNICODE)
|
|
310
|
+
|
|
311
|
+
with pytest.warns(DeprecationWarning):
|
|
312
|
+
compiled = core.template("expr")
|
|
313
|
+
|
|
314
|
+
expected_flags = strip_py_only_flags(
|
|
315
|
+
core._apply_default_unicode_flags("expr", 0)
|
|
316
|
+
)
|
|
317
|
+
assert captured["flags"] == expected_flags
|
|
318
|
+
assert compiled.flags == expected_flags
|
|
319
|
+
|
|
320
|
+
|
|
291
321
|
def test_pattern_match_handles_optional_end():
|
|
292
322
|
match_method = MethodRecorder(FakeMatch((0, 3), group0="matched"))
|
|
293
323
|
fake_cpattern = types.SimpleNamespace(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|