summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-07-26 12:12:56 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-07-26 12:12:56 (GMT)
commit9298eff5f9a9a0b7e80523a97723693482ed0392 (patch)
treecf19b69595c86717c07fe99e53dee8e990fb9c89 /Lib/socket.py
parent5f135787ec4040bfbeb16f2944086028635151db (diff)
downloadcpython-9298eff5f9a9a0b7e80523a97723693482ed0392.zip
cpython-9298eff5f9a9a0b7e80523a97723693482ed0392.tar.gz
cpython-9298eff5f9a9a0b7e80523a97723693482ed0392.tar.bz2
Bug #978833: Really close underlying socket in _socketobject.close.
Fix httplib.HTTPConnection.getresponse to not close the socket if it is still needed for the response.
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 4e83f09..52fb8e3 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -139,6 +139,8 @@ class _closedsocket(object):
__slots__ = []
def _dummy(*args):
raise error(EBADF, 'Bad file descriptor')
+ def close(self):
+ pass
# All _delegate_methods must also be initialized here.
send = recv = recv_into = sendto = recvfrom = recvfrom_into = _dummy
__getattr__ = _dummy
@@ -157,6 +159,7 @@ class _socketobject(object):
setattr(self, method, getattr(_sock, method))
def close(self):
+ self._sock.close()
self._sock = _closedsocket()
dummy = self._sock._dummy
for method in _delegate_methods: