mirror of
https://github.com/mrabarnett/mrab-regex.git
synced 2025-10-05 20:02:39 +02:00
Git issue 525: segfault when fuzzy matching empty list
This commit is contained in:
@@ -2111,6 +2111,9 @@ class Branch(RegexBase):
|
||||
return fs or set([None])
|
||||
|
||||
def _compile(self, reverse, fuzzy):
|
||||
if not self.branches:
|
||||
return []
|
||||
|
||||
code = [(OP.BRANCH, )]
|
||||
for b in self.branches:
|
||||
code.extend(b.compile(reverse, fuzzy))
|
||||
|
@@ -241,7 +241,7 @@ __all__ = ["cache_all", "compile", "DEFAULT_VERSION", "escape", "findall",
|
||||
"VERSION1", "X", "VERBOSE", "W", "WORD", "error", "Regex", "__version__",
|
||||
"__doc__", "RegexFlag"]
|
||||
|
||||
__version__ = "2.5.140"
|
||||
__version__ = "2.5.141"
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
# Public interface.
|
||||
|
@@ -4326,6 +4326,9 @@ thing
|
||||
self.assertEqual(regex.match(r'(?(?!a).|..)', 'ab').span(), (0, 2))
|
||||
self.assertEqual(regex.match(r'(?(?!b).|..)', 'ab').span(), (0, 1))
|
||||
|
||||
# Git issue 525: segfault when fuzzy matching empty list
|
||||
self.assertEqual(regex.match(r"(\L<foo>){e<=5}", "blah", foo=[]).span(), (0, 0))
|
||||
|
||||
def test_fuzzy_ext(self):
|
||||
self.assertEqual(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')),
|
||||
True)
|
||||
|
Reference in New Issue
Block a user