Repository navigation
Add Disk.with_options(on_error='miss') so unreadable entries are deleted and treated as missing instead of raising - #25
Merged
Conversation
Documentation build overview
7 files changed ·
|
…ted and treated as missing instead of raising.
avgvi
force-pushed
the
feat/configure-default-disk
branch
from
October 18, 2026 19:14
db65f75 to
dc35bfd
Compare
avgvi
force-pushed
the
feat/entry-errors-as-miss
branch
from
October 18, 2026 19:14
0ef3081 to
3148277
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in way to treat entries that exist but cannot be read back as missing, which downstream projects have each written by hand: a corrupt pickle, one that refers to a class a library upgrade removed, a value
SafeDiskrefuses, a stored path outside the cache, or a value file that is not valid text.Disk.with_options(on_error='miss')returns a disk type, on any disk class includingSafeDiskand the classeswith_typesreturns. Its caches delete such an entry and treat it as missing:getreturns its default,cache[key]raisesKeyError,pop,pull,peekandpeekitemmove on, and iteration,Index.items()andIndex.values()skip unreadable entries.diskcache_communitylogger and later ones at debug level.getreturns the default, whilepeekandpeekitemraise because they cannot move past the entry. A missing value file,MemoryErrorandRecursionErrorare never treated as unreadable.on_error='raise'. The option is a class attribute and is never persisted, so 5.6.3 still opens the directory.tests/test_entry_errors.pycover each read path, corrupt, stale, refused and tampered entries, statistics and eviction policies, read-only caches, logging, memoize, the containers, Django, a custom disk subclass, and pickling.Stacked on #24.
Verified: 519 tests pass on Python 3.12, 517 with 2 skipped on 3.10 and 3.14; blue, isort, flake8, mypy, doc8 and the Sphinx build with warnings as errors pass, and pylint reports what it reports on
master.