70
70
# Refs: https://github.com/python/cpython/issues/105456
71
71
# Refs: https://github.com/python/cpython/issues/91308
72
72
try :
73
- recompile = re ._compiler .compile
73
+ srecompile = re ._compiler .compile
74
74
except AttributeError :
75
75
import sre_compile
76
- recompile = sre_compile .compile
76
+ srecompile = sre_compile .compile
77
77
78
78
try :
79
79
# -- pylint: disable=used-before-assignment
@@ -1086,7 +1086,7 @@ def Match(pattern, s):
1086
1086
# performance reasons; factoring it out into a separate function turns out
1087
1087
# to be noticeably expensive.
1088
1088
if pattern not in _regexp_compile_cache :
1089
- _regexp_compile_cache [pattern ] = recompile (pattern )
1089
+ _regexp_compile_cache [pattern ] = srecompile (pattern )
1090
1090
return _regexp_compile_cache [pattern ].match (s )
1091
1091
1092
1092
@@ -1104,14 +1104,14 @@ def ReplaceAll(pattern, rep, s):
1104
1104
string with replacements made (or original string if no replacements)
1105
1105
"""
1106
1106
if pattern not in _regexp_compile_cache :
1107
- _regexp_compile_cache [pattern ] = recompile (pattern )
1107
+ _regexp_compile_cache [pattern ] = srecompile (pattern )
1108
1108
return _regexp_compile_cache [pattern ].sub (rep , s )
1109
1109
1110
1110
1111
1111
def Search (pattern , s ):
1112
1112
"""Searches the string for the pattern, caching the compiled regexp."""
1113
1113
if pattern not in _regexp_compile_cache :
1114
- _regexp_compile_cache [pattern ] = recompile (pattern )
1114
+ _regexp_compile_cache [pattern ] = srecompile (pattern )
1115
1115
return _regexp_compile_cache [pattern ].search (s )
1116
1116
1117
1117
0 commit comments