1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-19 04:21:14 +00:00

Merge pull request #473 from scorphus/gdbm-unavailable

#439 & #447: Remove cache if created with unavailable db
This commit is contained in:
Vladimir Iakovlev 2016-03-10 02:52:33 +03:00
commit d92765d5df

View File

@ -228,8 +228,8 @@ def cache(*depends_on):
value = fn(*args, **kwargs)
db[key] = {'etag': etag, 'value': value}
return value
except shelve_open_error:
# Caused when going from Python 2 to Python 3 and vice-versa
except (shelve_open_error, ImportError):
# Caused when switching between Python versions
warn("Removing possibly out-dated cache")
os.remove(cache_path)