Skip to content

Commit

Permalink
CachePath fixed bad cache from __new__ surviving error in __init__
Browse files Browse the repository at this point in the history
when initing a cache if a NoCachedMetadataError is raised then delete
the _cache attribute from the _local path to avoid wierdness

this manifested as a NameError in data.setter where cmeta could not
be bound the first time, but the stale ref to a non-existent _cache
would cause the second if statement to fire
  • Loading branch information
tgbugs committed Oct 2, 2019
1 parent af73c82 commit 5b3f595
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions augpathlib/caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(self, *args, meta=None, remote=None, **kwargs):
self._meta_updater(meta)
else:
if self.meta is None:
delattr(self._local, '_cache')
raise exc.NoCachedMetadataError(self.local)

super().__init__()
Expand Down
1 change: 1 addition & 0 deletions augpathlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ def data(self):
def data(self, generator):
if self.cache is not None:
cmeta = self.cache.meta

# FIXME do we touch a file, write the meta
# and then write the data?
# do we touch a temporary file, write the meta
Expand Down

0 comments on commit 5b3f595

Please sign in to comment.