Opened 8 years ago

Closed 8 years ago

#26694 closed Bug (fixed)

FileBasedCache.get() ignores all IOError errno values

Reported by: Jon Dufresne Owned by: nobody
Component: Core (Cache system) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Current implementation:

    def get(self, key, default=None, version=None):
        fname = self._key_to_file(key, version)
        try:
            with io.open(fname, 'rb') as f:
                if not self._is_expired(f):
                    return pickle.loads(zlib.decompress(f.read()))
        except IOError as e:
            if e.errno == errno.ENOENT:
                pass  # Cache file doesn't exist.
        return default

By inspection, this appears to be ignoring all errno values. However, judging from the surrounding code and comments, it should only be ignoring ENOENT. See discussion in PR #6652 for more details.

Change History (3)

comment:1 by Jon Dufresne, 8 years ago

Component: UncategorizedCore (Cache system)
Has patch: set

comment:2 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 7798296:

Fixed #26694 -- Made FileBasedCache.get() reraise non-ENOENT IOErrors.

Note: See TracTickets for help on using tickets.
Back to Top