Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Lib/encodings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ def search_function(encoding):
mod = None

if mod is None:
if len(_cache) < _MAXCACHE:
_cache[encoding] = None
if len(_cache) >= _MAXCACHE:
_cache.clear()
Comment thread
picnixz marked this conversation as resolved.
_cache[encoding] = None
return None

# Now ask the module for the registry entry
Expand All @@ -133,6 +134,8 @@ def search_function(encoding):
entry = codecs.CodecInfo(*entry)

# Cache the codec registry entry
if len(_cache) >= _MAXCACHE:
_cache.clear()
_cache[encoding] = entry

# Register its aliases (without overwriting previously registered
Expand Down
Loading