gh-106566: Optimize (?!) in regular expressions (GH-106567)

This commit is contained in:
Serhiy Storchaka 2023-08-07 18:09:56 +03:00 committed by GitHub
parent 50e3cc9748
commit ed64204716
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View file

@ -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 == "(":