Commit 65f8cedd authored by Guido van Rossum's avatar Guido van Rossum

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__.
parent bb1861a9
...@@ -232,7 +232,11 @@ class _fileobject(object): ...@@ -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:
......
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