diff --git a/Lib/re.py b/Lib/re.py --- a/Lib/re.py +++ b/Lib/re.py @@ -301,7 +301,7 @@ p = sre_compile.compile(pattern, flags) if not (flags & DEBUG): if len(_cache) >= _MAXCACHE: - _cache.clear() + _cache.popitem() if p.flags & LOCALE: if not _locale: return p