We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed48ab8 commit d57d397Copy full SHA for d57d397
1 file changed
Lib/encodings/__init__.py
@@ -111,8 +111,9 @@ def search_function(encoding):
111
mod = None
112
113
if mod is None:
114
- if len(_cache) < _MAXCACHE:
115
- _cache[encoding] = None
+ if len(_cache) >= _MAXCACHE:
+ _cache.clear()
116
+ _cache[encoding] = None
117
return None
118
119
# Now ask the module for the registry entry
@@ -133,6 +134,8 @@ def search_function(encoding):
133
134
entry = codecs.CodecInfo(*entry)
135
136
# Cache the codec registry entry
137
138
139
_cache[encoding] = entry
140
141
# Register its aliases (without overwriting previously registered
0 commit comments