diff options
author | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-09-27 04:04:15 +0000 |
---|---|---|
committer | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-09-27 04:04:15 +0000 |
commit | 867df33bf373c0df5f5f8ed2c042681f2b448ba0 (patch) | |
tree | d1c887c7b3dac31408074694a772b38bd1c1e15e /fs/remote.py | |
parent | 9285fb740f6737954cc14b7aad475fcee754bc41 (diff) | |
download | pyfilesystem-867df33bf373c0df5f5f8ed2c042681f2b448ba0.tar.gz |
RemoteFileBuffer.__del__: don't try to close if __init__ failed
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@443 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/remote.py')
-rw-r--r-- | fs/remote.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/remote.py b/fs/remote.py index 3ed3dba..8996c89 100644 --- a/fs/remote.py +++ b/fs/remote.py @@ -99,10 +99,14 @@ class RemoteFileBuffer(object): self.file.seek(0) def __del__(self): - if not self.closed: - self.close() + # Don't try to close a partially-constructed file + if "_lock" in self.__dict__: + if not self.closed: + self.close() def __getattr__(self,name): + if name in ("file","_lock","fs","path","mode","closed","_flushed"): + raise AttributeError(name) file = self.__dict__['file'] a = getattr(file, name) if not callable(a): |