Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-regex for openSUSE:Factory checked in at 2023-09-07 21:12:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-regex (Old) and /work/SRC/openSUSE:Factory/.python-regex.new.1766 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-regex" Thu Sep 7 21:12:20 2023 rev:23 rq:1109486 version:2023.8.8 Changes: -------- --- /work/SRC/openSUSE:Factory/python-regex/python-regex.changes 2023-05-15 16:54:02.656081652 +0200 +++ /work/SRC/openSUSE:Factory/.python-regex.new.1766/python-regex.changes 2023-09-07 21:12:40.565166048 +0200 @@ -1,0 +2,18 @@ +Thu Sep 7 08:18:52 UTC 2023 - Johannes Kastl <ka...@b1-systems.de> + +- update to 2023.8.8: + * Git issue 508: Regex doesn't build using CPython main + (3.13.0a0) + * Removed usage of _PyBytes_Join and did a little tidying of + the code that makes the result string. + +------------------------------------------------------------------- +Thu Sep 7 08:11:04 UTC 2023 - Johannes Kastl <ka...@b1-systems.de> + +- update to 2023.6.3: + * Git issue 498: Conditional negative lookahead inside positive + lookahead fails to match + * Conditional node needed an additional member that points to + the true branch. + +------------------------------------------------------------------- Old: ---- regex-2023.5.5.tar.gz New: ---- regex-2023.8.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-regex.spec ++++++ --- /var/tmp/diff_new_pack.SIJnO6/_old 2023-09-07 21:12:41.533200653 +0200 +++ /var/tmp/diff_new_pack.SIJnO6/_new 2023-09-07 21:12:41.533200653 +0200 @@ -16,11 +16,9 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} -%define skip_python2 1 %{?sle15_python_module_pythons} Name: python-regex -Version: 2023.5.5 +Version: 2023.8.8 Release: 0 Summary: Alternative regular expression module for Python License: Apache-2.0 ++++++ regex-2023.5.5.tar.gz -> regex-2023.8.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regex-2023.5.5/PKG-INFO new/regex-2023.8.8/PKG-INFO --- old/regex-2023.5.5/PKG-INFO 2023-05-03 19:28:21.521021000 +0200 +++ new/regex-2023.8.8/PKG-INFO 2023-08-08 22:38:00.256177700 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: regex -Version: 2023.5.5 +Version: 2023.8.8 Summary: Alternative regular expression module, to replace re. Home-page: https://github.com/mrabarnett/mrab-regex Author: Matthew Barnett @@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Scientific/Engineering :: Information Analysis Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Text Processing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regex-2023.5.5/regex.egg-info/PKG-INFO new/regex-2023.8.8/regex.egg-info/PKG-INFO --- old/regex-2023.5.5/regex.egg-info/PKG-INFO 2023-05-03 19:28:21.000000000 +0200 +++ new/regex-2023.8.8/regex.egg-info/PKG-INFO 2023-08-08 22:38:00.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: regex -Version: 2023.5.5 +Version: 2023.8.8 Summary: Alternative regular expression module, to replace re. Home-page: https://github.com/mrabarnett/mrab-regex Author: Matthew Barnett @@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 Classifier: Topic :: Scientific/Engineering :: Information Analysis Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: Text Processing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regex-2023.5.5/regex_3/_regex.c new/regex-2023.8.8/regex_3/_regex.c --- old/regex-2023.5.5/regex_3/_regex.c 2023-05-03 19:28:20.000000000 +0200 +++ new/regex-2023.8.8/regex_3/_regex.c 2023-08-08 22:37:59.000000000 +0200 @@ -291,6 +291,7 @@ union { struct { RE_NextNode next_2; + struct RE_Node* true_node; /* Used by a CONDITIONAL node. */ } nonstring; struct { /* Used only if (node->status & RE_STATUS_STRING) is true. */ @@ -15272,7 +15273,7 @@ /* It's a negative lookaround that's failed. Go to the 'true' * branch. */ - node = conditional->next_1.node; + node = conditional->nonstring.true_node; goto advance; } @@ -16990,7 +16991,6 @@ if (!lookaround->match) { /* It's a negative lookaround that's failed. */ - node = lookaround->nonstring.next_2.node; goto advance; } @@ -18706,8 +18706,8 @@ if (!item) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, 0, item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, 0, item); return result; } @@ -18726,8 +18726,8 @@ if (!item) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, i, item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, i, item); } return result; @@ -18786,8 +18786,8 @@ if (!item) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, 0, item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, 0, item); return result; } @@ -18806,8 +18806,8 @@ if (!item) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, i, item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, i, item); } return result; @@ -18867,8 +18867,8 @@ if (!item) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, 0, item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, 0, item); return result; } @@ -18888,8 +18888,8 @@ if (!item) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, i, item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, i, item); } return result; @@ -18923,8 +18923,8 @@ if (!slice) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, 0, slice); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, 0, slice); return result; } @@ -18945,8 +18945,8 @@ if (!slice) goto error; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(result, i, slice); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(result, i, slice); } return result; @@ -19282,13 +19282,13 @@ if (!keys) goto failed; - for (g = 0; g < PyList_GET_SIZE(keys); g++) { + for (g = 0; g < PyList_Size(keys); g++) { PyObject* key; PyObject* value; int status; - /* PyList_GET_ITEM borrows a reference. */ - key = PyList_GET_ITEM(keys, g); + /* PyList_GetItem borrows a reference. */ + key = PyList_GetItem(keys, g); if (!key) goto failed; @@ -19326,14 +19326,14 @@ if (!keys) goto failed; - for (g = 0; g < PyList_GET_SIZE(keys); g++) { + for (g = 0; g < PyList_Size(keys); g++) { PyObject* key; Py_ssize_t group; PyObject* captures; int status; - /* PyList_GET_ITEM borrows a reference. */ - key = PyList_GET_ITEM(keys, g); + /* PyList_GetItem borrows a reference. */ + key = PyList_GetItem(keys, g); if (!key) goto failed; @@ -19509,12 +19509,12 @@ goto error; } - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(join_info->list, 0, join_info->item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(join_info->list, 0, join_info->item); join_info->item = NULL; - /* PyList_SET_ITEM borrows the reference. */ - PyList_SET_ITEM(join_info->list, 1, new_item); + /* PyList_SetItem borrows the reference. */ + PyList_SetItem(join_info->list, 1, new_item); return 0; } @@ -19535,38 +19535,78 @@ Py_XDECREF(join_info->item); } +/* Joins a list of bytestrings. */ +Py_LOCAL_INLINE(PyObject*) join_bytestrings(PyObject* list) { + Py_ssize_t count; + Py_ssize_t length; + Py_ssize_t i; + PyObject *result; + char* to_bytes; + + count = PyList_Size(list); + + /* How long will the result be? */ + length = 0; + + for (i = 0; i < count; i++) + length += PyBytes_Size(PyList_GetItem(list, i)); + + /* Create the resulting bytestring, but uninitialised. */ + result = PyBytes_FromStringAndSize(NULL, length); + if (!result) + return NULL; + + /* Fill the resulting bytestring. */ + to_bytes = PyBytes_AsString(result); + length = 0; + + for (i = 0; i < count; i++) { + PyObject* bytestring; + char* from_bytes; + Py_ssize_t from_length; + + bytestring = PyList_GetItem(list, i); + from_bytes = PyBytes_AsString(bytestring); + from_length = PyBytes_Size(bytestring); + memmove(to_bytes + length, from_bytes, from_length); + length += from_length; + } + + return result; +} + +/* Joins a list of strings. */ +Py_LOCAL_INLINE(PyObject*) join_strings(PyObject* list) { + PyObject* joiner; + PyObject* result; + + joiner = PyUnicode_FromString(""); + if (!joiner) + return NULL; + + result = PyUnicode_Join(joiner, list); + Py_DECREF(joiner); + + return result; +} + /* Joins together a list of strings for pattern_subx. */ Py_LOCAL_INLINE(PyObject*) join_list_info(RE_JoinInfo* join_info) { /* If the list already exists then just do the join. */ if (join_info->list) { - PyObject* joiner; PyObject* result; if (join_info->reversed) /* The list needs to be reversed before being joined. */ PyList_Reverse(join_info->list); - if (join_info->is_unicode) { + if (join_info->is_unicode) /* Concatenate the Unicode strings. */ - joiner = PyUnicode_New(0, 0); - if (!joiner) { - clear_join_list(join_info); - return NULL; - } - - result = PyUnicode_Join(joiner, join_info->list); - } else { - joiner = PyBytes_FromString(""); - if (!joiner) { - clear_join_list(join_info); - return NULL; - } - + result = join_strings(join_info->list); + else /* Concatenate the bytestrings. */ - result = _PyBytes_Join(joiner, join_info->list); - } + result = join_bytestrings(join_info->list); - Py_DECREF(joiner); clear_join_list(join_info); return result; @@ -19651,13 +19691,13 @@ init_join_list(&join_info, FALSE, PyUnicode_Check(self->string)); /* Add each part of the template to the list. */ - size = PyList_GET_SIZE(replacement); + size = PyList_Size(replacement); for (i = 0; i < size; i++) { PyObject* item; PyObject* str_item; - /* PyList_GET_ITEM borrows a reference. */ - item = PyList_GET_ITEM(replacement, i); + /* PyList_GetItem borrows a reference. */ + item = PyList_GetItem(replacement, i); str_item = get_match_replacement(self, item, self->group_count); if (!str_item) goto error; @@ -19727,19 +19767,19 @@ if (!values) goto failed; - for (g = 0; g < PyList_GET_SIZE(keys); g++) { + for (g = 0; g < PyList_Size(keys); g++) { PyObject* key; PyObject* value; Py_ssize_t v; int status; - /* PyList_GET_ITEM borrows a reference. */ - key = PyList_GET_ITEM(keys, g); + /* PyList_GetItem borrows a reference. */ + key = PyList_GetItem(keys, g); if (!key) goto failed; - /* PyList_GET_ITEM borrows a reference. */ - value = PyList_GET_ITEM(values, g); + /* PyList_GetItem borrows a reference. */ + value = PyList_GetItem(values, g); if (!value) goto failed; @@ -21742,7 +21782,7 @@ Py_ssize_t step; /* Add each part of the template to the list. */ - count = PyList_GET_SIZE(replacement); + count = PyList_Size(replacement); if (join_info.reversed) { /* We're searching backwards, so we'll be reversing the list * when it's complete. Therefore, we need to add the items of @@ -21761,8 +21801,8 @@ PyObject* item; PyObject* str_item; - /* PyList_GET_ITEM borrows a reference. */ - item = PyList_GET_ITEM(replacement, index); + /* PyList_GetItem borrows a reference. */ + item = PyList_GetItem(replacement, index); str_item = get_sub_replacement(item, string, &state, self->public_group_count); if (!str_item) @@ -22986,6 +23026,14 @@ node->nonstring.next_2.node = next->next_1.node; modified = TRUE; } + + /* Check the true branch for CONDITIONAL. */ + next = node->nonstring.true_node; + if (next && next->op == RE_OP_BRANCH && + !next->nonstring.true_node) { + node->nonstring.true_node = next->next_1.node; + modified = TRUE; + } } } while (modified); @@ -24443,6 +24491,7 @@ /* end test node -> true branch -> end node */ add_node(end_test_node, subargs.start); add_node(subargs.end, end_node); + test_node->nonstring.true_node = subargs.start; if (args->code[0] == RE_OP_NEXT) { /* There's a false branch. */ @@ -25710,7 +25759,7 @@ unpacked = FALSE; /* Read the regex code. */ - code_len = PyList_GET_SIZE(code_list); + code_len = PyList_Size(code_list); code = (RE_CODE*)re_alloc((size_t)code_len * sizeof(RE_CODE)); if (!code) { if (unpacked) { @@ -25724,8 +25773,8 @@ PyObject* o; size_t value; - /* PyList_GET_ITEM borrows a reference. */ - o = PyList_GET_ITEM(code_list, i); + /* PyList_GetItem borrows a reference. */ + o = PyList_GetItem(code_list, i); value = PyLong_AsUnsignedLong(o); if ((Py_ssize_t)value == -1 && PyErr_Occurred()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regex-2023.5.5/regex_3/_regex_core.py new/regex-2023.8.8/regex_3/_regex_core.py --- old/regex-2023.5.5/regex_3/_regex_core.py 2023-05-03 19:28:20.000000000 +0200 +++ new/regex-2023.8.8/regex_3/_regex_core.py 2023-08-08 22:37:59.000000000 +0200 @@ -3000,18 +3000,19 @@ def _compile(self, reverse, fuzzy): code = [] - key = self.group, reverse, fuzzy - ref = self.info.call_refs.get(key) - if ref is not None: - code += [(OP.CALL_REF, ref)] - public_group = private_group = self.group if private_group < 0: public_group = self.info.private_groups[private_group] private_group = self.info.group_count - private_group - code += ([(OP.GROUP, int(not reverse), private_group, public_group)] + - self.subpattern.compile(reverse, fuzzy) + [(OP.END, )]) + key = self.group, reverse, fuzzy + ref = self.info.call_refs.get(key) + if ref is not None: + code += [(OP.CALL_REF, ref)] + + code += [(OP.GROUP, int(not reverse), private_group, public_group)] + code += self.subpattern.compile(reverse, fuzzy) + code += [(OP.END, )] if ref is not None: code += [(OP.END, )] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regex-2023.5.5/regex_3/regex.py new/regex-2023.8.8/regex_3/regex.py --- old/regex-2023.5.5/regex_3/regex.py 2023-05-03 19:28:20.000000000 +0200 +++ new/regex-2023.8.8/regex_3/regex.py 2023-08-08 22:37:59.000000000 +0200 @@ -241,7 +241,7 @@ "VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__", "__doc__", "RegexFlag"] -__version__ = "2.5.128" +__version__ = "2.5.132" # -------------------------------------------------------------------- # Public interface. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regex-2023.5.5/regex_3/test_regex.py new/regex-2023.8.8/regex_3/test_regex.py --- old/regex-2023.5.5/regex_3/test_regex.py 2023-05-03 19:28:20.000000000 +0200 +++ new/regex-2023.8.8/regex_3/test_regex.py 2023-08-08 22:37:59.000000000 +0200 @@ -3289,7 +3289,7 @@ "female: her dog; male: his cat. asdsasda")], ['female: her dog', 'male: his cat']) - # Hg issue 78: "Captures"doesn't work for recursive calls + # Hg issue 78: "Captures" doesn't work for recursive calls self.assertEqual(regex.search(r'(?<rec>\((?:[^()]++|(?&rec))*\))', 'aaa(((1+0)+1)+1)bbb').captures('rec'), ['(1+0)', '((1+0)+1)', '(((1+0)+1)+1)']) @@ -3624,6 +3624,9 @@ self.assertEqual(regex.search(r'(?(DEFINE)(?<quant>\d+)(?<item>\w+))(?&quant) (?&item)', '5 elephants')[0], '5 elephants') + self.assertEqual(regex.search(r'(?&routine)(?(DEFINE)(?<routine>.))', 'a').group('routine'), None) + self.assertEqual(regex.search(r'(?&routine)(?(DEFINE)(?<routine>.))', 'a').captures('routine'), ['a']) + # Hg issue 153: Request: (*SKIP). self.assertEqual(regex.search(r'12(*FAIL)|3', '123')[0], '3') self.assertEqual(regex.search(r'(?r)12(*FAIL)|3', '123')[0], '3') @@ -4332,6 +4335,12 @@ # Git issue 494: Backtracking failure matching regex ^a?(a?)b?c\1$ against string abca self.assertEqual(regex.search(r"^a?(a?)b?c\1$", "abca").span(), (0, 4)) + # Git issue 498: Conditional negative lookahead inside positive lookahead fails to match + self.assertEqual(regex.match(r"(?(?=a).|..)", "ab").span(), (0, 1)) + self.assertEqual(regex.match(r"(?(?=b).|..)", "ab").span(), (0, 2)) + self.assertEqual(regex.match(r"(?(?!a).|..)", "ab").span(), (0, 2)) + self.assertEqual(regex.match(r"(?(?!b).|..)", "ab").span(), (0, 1)) + def test_fuzzy_ext(self): self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')), True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/regex-2023.5.5/setup.py new/regex-2023.8.8/setup.py --- old/regex-2023.5.5/setup.py 2023-05-03 19:28:20.000000000 +0200 +++ new/regex-2023.8.8/setup.py 2023-08-08 22:37:59.000000000 +0200 @@ -7,7 +7,7 @@ setup( name='regex', - version='2023.5.5', + version='2023.8.8', description='Alternative regular expression module, to replace re.', long_description=long_description, long_description_content_type='text/x-rst', @@ -27,6 +27,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Scientific/Engineering :: Information Analysis', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Text Processing',