summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 9598f99..b95c372 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -232,7 +232,11 @@ class _fileobject(object):
self._sock = None
def __del__(self):
- self.close()
+ try:
+ self.close()
+ except:
+ # close() may fail if __init__ didn't complete
+ pass
def flush(self):
if self._wbuf: