From f46728542b4fea608022016ab560d9abc8ad7f7f Mon Sep 17 00:00:00 2001 From: Matthew Barnett Date: Wed, 11 Sep 2024 18:00:38 +0100 Subject: [PATCH 1/4] Updated to actions/download-artifact@v4 in main.yml. --- .github/workflows/main.yml | 2 +- changelog.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20285a9..f329469 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -165,7 +165,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@4.1.7 + - uses: actions/download-artifact@v4 with: name: regex-files path: dist diff --git a/changelog.txt b/changelog.txt index 7d524f1..196f0e7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version: 2024.9.12 + + Updated to actions/download-artifact@v4 in main.yml. + Version: 2024.9.11 Updated to Unicode 16.0.0. From 1bcd42e8381feaf3040f4b4a6a10dab912e6b59c Mon Sep 17 00:00:00 2001 From: Matthew Barnett Date: Wed, 11 Sep 2024 18:53:31 +0100 Subject: [PATCH 2/4] Updated to actions/upload-artifact@v4 in main.yml. --- .github/workflows/main.yml | 8 ++++---- changelog.txt | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f329469..7364062 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: python -m cibuildwheel --output-dir wheelhouse - name: Upload wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: regex-files path: wheelhouse/*.whl @@ -111,13 +111,13 @@ jobs: python -m cibuildwheel --output-dir wheelhouse - name: Upload source distribution - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: regex-files path: dist/*.tar.gz - name: Upload manylinux1_x86_64 wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: regex-files path: wheelhouse/*.whl @@ -153,7 +153,7 @@ jobs: python -m cibuildwheel --output-dir wheelhouse - name: Upload ${{ matrix.arch }} wheels - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: regex-files path: wheelhouse/*.whl diff --git a/changelog.txt b/changelog.txt index 196f0e7..ba2ca26 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version: 2024.9.13 + + Updated to actions/upload-artifact@v4 in main.yml. + Version: 2024.9.12 Updated to actions/download-artifact@v4 in main.yml. From 64834c729b8e117c1f9a471d9e1e51f32b69a121 Mon Sep 17 00:00:00 2001 From: Matthew Barnett Date: Wed, 11 Sep 2024 19:36:34 +0100 Subject: [PATCH 3/4] Reverted to actions/download-artifact@v3 and actions/upload-artifact@v3 in main.yml because GitHub Actions failed when using them. --- .github/workflows/main.yml | 10 +++++----- changelog.txt | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7364062..172fdd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: python -m cibuildwheel --output-dir wheelhouse - name: Upload wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: regex-files path: wheelhouse/*.whl @@ -111,13 +111,13 @@ jobs: python -m cibuildwheel --output-dir wheelhouse - name: Upload source distribution - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: regex-files path: dist/*.tar.gz - name: Upload manylinux1_x86_64 wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: regex-files path: wheelhouse/*.whl @@ -153,7 +153,7 @@ jobs: python -m cibuildwheel --output-dir wheelhouse - name: Upload ${{ matrix.arch }} wheels - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: regex-files path: wheelhouse/*.whl @@ -165,7 +165,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v4 + - uses: actions/download-artifact@v3 with: name: regex-files path: dist diff --git a/changelog.txt b/changelog.txt index ba2ca26..05e17f4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version: 2024.9.14 + + Reverted to actions/download-artifact@v3 and actions/upload-artifact@v3 in main.yml because GitHub Actions failed when using them. + Version: 2024.9.13 Updated to actions/upload-artifact@v4 in main.yml. From 930983aa68ffc133ec086ef16cabdbb9c0c491ea Mon Sep 17 00:00:00 2001 From: Matthew Barnett Date: Wed, 6 Nov 2024 19:48:55 +0000 Subject: [PATCH 4/4] Git issue 546: Partial match not working in some instances with non-greedy capture --- changelog.txt | 4 ++++ regex_3/_regex.c | 18 ------------------ regex_3/regex.py | 2 +- regex_3/test_regex.py | 10 ++++++++++ setup.py | 2 +- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/changelog.txt b/changelog.txt index 05e17f4..e017bd1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version: 2024.11.6 + + Git issue 546: Partial match not working in some instances with non-greedy capture + Version: 2024.9.14 Reverted to actions/download-artifact@v3 and actions/upload-artifact@v3 in main.yml because GitHub Actions failed when using them. diff --git a/regex_3/_regex.c b/regex_3/_regex.c index 9164e75..7a84294 100644 --- a/regex_3/_regex.c +++ b/regex_3/_regex.c @@ -16535,9 +16535,6 @@ Py_LOCAL_INLINE(int) basic_match(RE_State* state, BOOL search) { RE_PARTIAL_RIGHT) return RE_ERROR_PARTIAL; - if (pos >= limit) - break; - /* Look for the tail string. */ found = string_search(state, test, pos + 1, limit + length, TRUE, &is_partial); @@ -16593,9 +16590,6 @@ Py_LOCAL_INLINE(int) basic_match(RE_State* state, BOOL search) { RE_PARTIAL_RIGHT) return RE_ERROR_PARTIAL; - if (pos >= limit) - break; - /* Look for the tail string. */ found = string_search_fld(state, test, pos + 1, limit, &new_pos, &is_partial); @@ -16651,9 +16645,6 @@ Py_LOCAL_INLINE(int) basic_match(RE_State* state, BOOL search) { if (pos <= state->text_start && state->partial_side == RE_PARTIAL_LEFT) return RE_ERROR_PARTIAL; - if (pos <= limit) - break; - /* Look for the tail string. */ found = string_search_fld_rev(state, test, pos - 1, limit, &new_pos, &is_partial); @@ -16713,9 +16704,6 @@ Py_LOCAL_INLINE(int) basic_match(RE_State* state, BOOL search) { RE_PARTIAL_RIGHT) return RE_ERROR_PARTIAL; - if (pos >= limit) - break; - /* Look for the tail string. */ found = string_search_ign(state, test, pos + 1, limit + length, TRUE, &is_partial); @@ -16773,9 +16761,6 @@ Py_LOCAL_INLINE(int) basic_match(RE_State* state, BOOL search) { if (pos <= state->text_start && state->partial_side == RE_PARTIAL_LEFT) return RE_ERROR_PARTIAL; - if (pos <= limit) - break; - /* Look for the tail string. */ found = string_search_ign_rev(state, test, pos - 1, limit - length, TRUE, &is_partial); @@ -16833,9 +16818,6 @@ Py_LOCAL_INLINE(int) basic_match(RE_State* state, BOOL search) { if (pos <= state->text_start && state->partial_side == RE_PARTIAL_LEFT) return RE_ERROR_PARTIAL; - if (pos <= limit) - break; - /* Look for the tail string. */ found = string_search_rev(state, test, pos - 1, limit - length, TRUE, &is_partial); diff --git a/regex_3/regex.py b/regex_3/regex.py index 3019c38..0fdb4da 100644 --- a/regex_3/regex.py +++ b/regex_3/regex.py @@ -241,7 +241,7 @@ "VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__", "__doc__", "RegexFlag"] -__version__ = "2.5.147" +__version__ = "2.5.148" # -------------------------------------------------------------------- # Public interface. diff --git a/regex_3/test_regex.py b/regex_3/test_regex.py index dc72f26..bce5a87 100644 --- a/regex_3/test_regex.py +++ b/regex_3/test_regex.py @@ -4346,6 +4346,16 @@ def test_hg_bugs(self): self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/xy", partial=True).span(), (0, 4)) self.assertEqual(regex.match(r"(?i)[^/]*b/xyz", "b/yz", partial=True), None) + # Git issue 546: Partial match not working in some instances with non-greedy capture + self.assertEqual(bool(regex.match(r'.*?', '<', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', '.*?', '', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'x', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo ', partial=True)), True) + self.assertEqual(bool(regex.match(r'.*?', 'xyz abc foo bar', partial=True)), True) + def test_fuzzy_ext(self): self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')), True) diff --git a/setup.py b/setup.py index 55ae8ce..ba64e5f 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='regex', - version='2024.9.11', + version='2024.11.6', description='Alternative regular expression module, to replace re.', long_description=long_description, long_description_content_type='text/x-rst',