diff options
author | Guido van Rossum <guido@python.org> | 2003-05-29 14:36:57 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-05-29 14:36:57 (GMT) |
commit | 65f8cedd4a9820e5d069ece0194b7da0b1e4e33c (patch) | |
tree | 007ee4a343cb28ccfe79f026a0821a13c77ca55e /Lib/socket.py | |
parent | bb1861a996f659621a3d9de875027679ce1926eb (diff) | |
download | cpython-65f8cedd4a9820e5d069ece0194b7da0b1e4e33c.zip cpython-65f8cedd4a9820e5d069ece0194b7da0b1e4e33c.tar.gz cpython-65f8cedd4a9820e5d069ece0194b7da0b1e4e33c.tar.bz2 |
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__.
Diffstat (limited to 'Lib/socket.py')
-rw-r--r-- | Lib/socket.py | 6 |
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: |