Commit f8c0a39d by rfkelly0

RemoteFileBuffer.__del__: don't try to close if __init__ failed

parent 2e1b4935
...@@ -99,10 +99,14 @@ class RemoteFileBuffer(object): ...@@ -99,10 +99,14 @@ class RemoteFileBuffer(object):
self.file.seek(0) self.file.seek(0)
def __del__(self): def __del__(self):
if not self.closed: # Don't try to close a partially-constructed file
self.close() if "_lock" in self.__dict__:
if not self.closed:
self.close()
def __getattr__(self,name): def __getattr__(self,name):
if name in ("file","_lock","fs","path","mode","closed","_flushed"):
raise AttributeError(name)
file = self.__dict__['file'] file = self.__dict__['file']
a = getattr(file, name) a = getattr(file, name)
if not callable(a): if not callable(a):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment