I saw errors from _fileobject.__del__ about missing self._sock. This

can happen if __init__ doesn't complete.  Fix it by adding a
try/except to __del__.
This commit is contained in:
Guido van Rossum 2003-05-29 14:36:57 +00:00
parent bb1861a996
commit 65f8cedd4a
1 changed files with 5 additions and 1 deletions

View File

@ -232,7 +232,11 @@ class _fileobject(object):
self._sock = None self._sock = None
def __del__(self): def __del__(self):
self.close() try:
self.close()
except:
# close() may fail if __init__ didn't complete
pass
def flush(self): def flush(self):
if self._wbuf: if self._wbuf: