mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Set cache sizes to a power-of-two
This commit is contained in:
parent
5b49962f7e
commit
d0dbb20f5f
2 changed files with 3 additions and 3 deletions
|
@ -261,7 +261,7 @@ def escape(pattern):
|
|||
|
||||
_pattern_type = type(sre_compile.compile("", 0))
|
||||
|
||||
@functools.lru_cache(maxsize=500, typed=True)
|
||||
@functools.lru_cache(maxsize=512, typed=True)
|
||||
def _compile(pattern, flags):
|
||||
# internal: compile pattern
|
||||
if isinstance(pattern, _pattern_type):
|
||||
|
@ -273,7 +273,7 @@ def _compile(pattern, flags):
|
|||
raise TypeError("first argument must be string or compiled pattern")
|
||||
return sre_compile.compile(pattern, flags)
|
||||
|
||||
@functools.lru_cache(maxsize=500)
|
||||
@functools.lru_cache(maxsize=512)
|
||||
def _compile_repl(repl, pattern):
|
||||
# internal: compile replacement pattern
|
||||
return sre_parse.parse_template(repl, pattern)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue