1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Fixed #30899 -- Lazily compiled import time regular expressions.

This commit is contained in:
Hasan Ramezani
2019-10-26 16:42:32 +02:00
committed by Mariusz Felisiak
parent 39a34d4bf9
commit e3d0b4d550
34 changed files with 114 additions and 95 deletions

View File

@@ -5,6 +5,7 @@ from email.errors import HeaderParseError
from email.parser import HeaderParser
from django.urls import reverse
from django.utils.regex_helper import _lazy_re_compile
from django.utils.safestring import mark_safe
try:
@@ -146,8 +147,8 @@ if docutils_is_available:
create_reference_role(name, urlbase)
# Match the beginning of a named or unnamed group.
named_group_matcher = re.compile(r'\(\?P(<\w+>)')
unnamed_group_matcher = re.compile(r'\(')
named_group_matcher = _lazy_re_compile(r'\(\?P(<\w+>)')
unnamed_group_matcher = _lazy_re_compile(r'\(')
def replace_named_groups(pattern):