Skip to content

[3.7] bpo-37723: Fix performance regression on regular expression parsing. (GH-15030) #15060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Lib/sre_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,7 @@ def _escape(source, escape, state):
raise source.error("bad escape %s" % escape, len(escape))

def _uniq(items):
if len(set(items)) == len(items):
return items
newitems = []
for item in items:
if item not in newitems:
newitems.append(item)
return newitems
return list(dict.fromkeys(items))

def _parse_sub(source, state, verbose, nested):
# parse an alternation: a|b|c
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,7 @@ Michael Urman
Hector Urtubia
Lukas Vacek
Ville Vainio
Yann Vaginay
Andi Vajda
Case Van Horsen
John Mark Vandenberg
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix performance regression on regular expression parsing with huge
character sets. Patch by Yann Vaginay.