|
|
@@ -200,7 +200,7 @@ class EntryReadStream(object): |
|
|
|
return self |
|
|
|
|
|
|
|
def __exit__(self, *args): |
|
|
|
return |
|
|
|
self.close() |
|
|
|
|
|
|
|
def __iter__(self): |
|
|
|
if self.closed: |
|
|
@@ -438,6 +438,10 @@ class Archive(object): |
|
|
|
self.encoding = encoding |
|
|
|
self.blocksize = blocksize |
|
|
|
self.password = password |
|
|
|
try: |
|
|
|
f = str(f) |
|
|
|
except: |
|
|
|
pass |
|
|
|
if isinstance(f, str): |
|
|
|
self.filename = f |
|
|
|
f = open(f, mode) |
|
|
@@ -493,7 +497,7 @@ class Archive(object): |
|
|
|
return self |
|
|
|
|
|
|
|
def __exit__(self, type, value, traceback): |
|
|
|
self.denit() |
|
|
|
self.close() |
|
|
|
|
|
|
|
def __del__(self): |
|
|
|
self.close() |
|
|
@@ -543,9 +547,7 @@ class Archive(object): |
|
|
|
if _defer: |
|
|
|
# This call came from our open stream. |
|
|
|
self._stream = None |
|
|
|
if not self._defer_close: |
|
|
|
# We are not yet ready to close. |
|
|
|
return |
|
|
|
return |
|
|
|
if self._stream is not None: |
|
|
|
# We have a stream open! don't close, but remember we were asked to. |
|
|
|
self._defer_close = True |
|
|
@@ -563,7 +565,7 @@ class Archive(object): |
|
|
|
if hasattr(self.f, "fileno"): |
|
|
|
os.fsync(self.f.fileno()) |
|
|
|
# and then close it, if we opened it... |
|
|
|
if getattr(self, '_close', None): |
|
|
|
if getattr(self.f, 'close', None): |
|
|
|
self.f.close() |
|
|
|
|
|
|
|
@property |
|
|
|