Skip to content

Commit 2e3272b

Browse files
author
Matthew Barnett
committed
Git issue 527: VERBOSE/X flag breaks \N escapes
1 parent 9c950f2 commit 2e3272b

File tree

6 files changed

+16
-9
lines changed

6 files changed

+16
-9
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
env:
1111
PYTHON_VER: '3.10' # Python to run test/cibuildwheel
12-
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*
12+
CIBW_BUILD: cp38-* cp39-* cp310-* cp311-* cp312-*
1313
CIBW_TEST_COMMAND: python -m unittest regex.test_regex
1414

1515
jobs:
@@ -94,7 +94,7 @@ jobs:
9494
# manylinux2014 >=19.3 3.7.8+, 3.8.4+, 3.9.0+ 2.17 (2012-12-25)
9595
# manylinux_x_y >=20.3 3.8.10+, 3.9.5+, 3.10.0+ x.y
9696
# manylinux2010 images EOL on 2022-08-01, it doesn't support cp311.
97-
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-*
97+
CIBW_BUILD: cp38-* cp39-* cp310-*
9898
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
9999
CIBW_ARCHS_LINUX: x86_64
100100

changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version: 2024.4.28
2+
3+
Git issue 527: `VERBOSE`/`X` flag breaks `\N` escapes
4+
15
Version: 2024.4.16
26

37
Git issue 525: segfault when fuzzy matching empty list

regex_3/_regex_core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ def parse_named_char(source, info, in_set):
13591359
"Parses a named character."
13601360
saved_pos = source.pos
13611361
if source.match("{"):
1362-
name = source.get_while(NAMED_CHAR_PART)
1362+
name = source.get_while(NAMED_CHAR_PART, keep_spaces=True)
13631363
if source.match("}"):
13641364
try:
13651365
value = unicodedata.lookup(name)
@@ -4067,11 +4067,11 @@ def get_many(self, count=1):
40674067
self.pos = len(string)
40684068
return "".join(substring)
40694069

4070-
def get_while(self, test_set, include=True):
4070+
def get_while(self, test_set, include=True, keep_spaces=False):
40714071
string = self.string
40724072
pos = self.pos
40734073

4074-
if self.ignore_space:
4074+
if self.ignore_space and not keep_spaces:
40754075
try:
40764076
substring = []
40774077

regex_3/regex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
"VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__",
242242
"__doc__", "RegexFlag"]
243243

244-
__version__ = "2.5.141"
244+
__version__ = "2.5.142"
245245

246246
# --------------------------------------------------------------------
247247
# Public interface.

regex_3/test_regex.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4329,6 +4329,10 @@ def test_hg_bugs(self):
43294329
# Git issue 525: segfault when fuzzy matching empty list
43304330
self.assertEqual(regex.match(r"(\L<foo>){e<=5}", "blah", foo=[]).span(), (0, 0))
43314331

4332+
# Git issue 527: `VERBOSE`/`X` flag breaks `\N` escapes
4333+
self.assertEqual(regex.compile(r'\N{LATIN SMALL LETTER A}').match('a').span(), (0, 1))
4334+
self.assertEqual(regex.compile(r'\N{LATIN SMALL LETTER A}', flags=regex.X).match('a').span(), (0, 1))
4335+
43324336
def test_fuzzy_ext(self):
43334337
self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')),
43344338
True)

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name='regex',
10-
version='2024.4.16',
10+
version='2024.4.28',
1111
description='Alternative regular expression module, to replace re.',
1212
long_description=long_description,
1313
long_description_content_type='text/x-rst',
@@ -21,7 +21,6 @@
2121
'Intended Audience :: Developers',
2222
'License :: OSI Approved :: Apache Software License',
2323
'Operating System :: OS Independent',
24-
'Programming Language :: Python :: 3.7',
2524
'Programming Language :: Python :: 3.8',
2625
'Programming Language :: Python :: 3.9',
2726
'Programming Language :: Python :: 3.10',
@@ -32,7 +31,7 @@
3231
'Topic :: Text Processing',
3332
'Topic :: Text Processing :: General',
3433
],
35-
python_requires='>=3.7',
34+
python_requires='>=3.8',
3635

3736
package_dir={'regex': 'regex_3'},
3837
py_modules=['regex.__init__', 'regex.regex', 'regex._regex_core',

0 commit comments

Comments
 (0)