gh-91524: Speed up the regular expression substitution (#91525)

Functions re.sub() and re.subn() and corresponding re.Pattern methods
are now 2-3 times faster for replacement strings containing group references.

Closes #91524

Primarily authored by serhiy-storchaka Serhiy Storchaka
Minor-cleanups-by: Gregory P. Smith [Google] <greg@krypto.org>
This commit is contained in:
Serhiy Storchaka 2022-10-24 01:57:30 +03:00 committed by GitHub
parent 176b6c57be
commit 75a6fadf36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 358 additions and 91 deletions

View file

@ -13,7 +13,7 @@
# update when constants are added or removed
MAGIC = 20220615
MAGIC = 20221023
from _sre import MAXREPEAT, MAXGROUPS