summaryrefslogtreecommitdiffstats
path: root/Lib/re
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-08-07 15:09:56 (GMT)
committerGitHub <noreply@github.com>2023-08-07 15:09:56 (GMT)
commited64204716035db58c7e11b78182596aa2d97176 (patch)
tree3b21b42919fef0eb14bd504d53b4da2a174e9d4c /Lib/re
parent50e3cc9748eb2103eb7ed6cc5a74d177df3cfb13 (diff)
downloadcpython-ed64204716035db58c7e11b78182596aa2d97176.zip
cpython-ed64204716035db58c7e11b78182596aa2d97176.tar.gz
cpython-ed64204716035db58c7e11b78182596aa2d97176.tar.bz2
gh-106566: Optimize (?!) in regular expressions (GH-106567)
Diffstat (limited to 'Lib/re')
-rw-r--r--Lib/re/_parser.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/re/_parser.py b/Lib/re/_parser.py
index 22d10ab..d00b7e6 100644
--- a/Lib/re/_parser.py
+++ b/Lib/re/_parser.py
@@ -773,8 +773,10 @@ def _parse(source, state, verbose, nested, first=False):
source.tell() - start)
if char == "=":
subpatternappend((ASSERT, (dir, p)))
- else:
+ elif p:
subpatternappend((ASSERT_NOT, (dir, p)))
+ else:
+ subpatternappend((FAILURE, ()))
continue
elif char == "(":