diff --git a/lib/cachecontrol/adapter.py b/lib/cachecontrol/adapter.py index d2ca7e87..b43b0f06 100644 --- a/lib/cachecontrol/adapter.py +++ b/lib/cachecontrol/adapter.py @@ -58,7 +58,11 @@ class CacheControlAdapter(HTTPAdapter): response = cached_response else: # try to cache the response - self.controller.cache_response(request, response) + try: + self.controller.cache_response(request, response) + except Exception as e: + # Failed to cache the results + pass resp = super(CacheControlAdapter, self).build_response( request, response diff --git a/lib/lockfile/linklockfile.py b/lib/lockfile/linklockfile.py index 9c506734..770350f2 100644 --- a/lib/lockfile/linklockfile.py +++ b/lib/lockfile/linklockfile.py @@ -5,6 +5,7 @@ import os from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, AlreadyLocked) +import errno class LinkLockFile(LockBase): """Lock access to a file using atomic property of link(2). @@ -28,7 +29,9 @@ class LinkLockFile(LockBase): # Try and create a hard link to it. try: os.link(self.unique_name, self.lock_file) - except OSError: + except OSError as e: + if e.errno == errno.ENOSYS: + raise LockFailed("%s" % e.strerror) # Link creation failed. Maybe we've double-locked? nlinks = os.stat(self.unique_name).st_nlink if nlinks == 2: