]> granicus.if.org Git - python/commitdiff
Bug #978833: Revert r50844, as it broke _socketobject.dup.
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 23 Mar 2007 13:27:15 +0000 (13:27 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 23 Mar 2007 13:27:15 +0000 (13:27 +0000)
Will backport.

Lib/httplib.py
Lib/socket.py
Misc/NEWS

index 4797e0317d048d142e4422bfe875ec1e6d72cf6b..213d80c2b4393030fdd59b23b6637a85e3b2d3a2 100644 (file)
@@ -948,8 +948,8 @@ class HTTPConnection:
         self.__state = _CS_IDLE
 
         if response.will_close:
-            # Pass the socket to the response
-            self.sock = None
+            # this effectively passes the connection to the response
+            self.close()
         else:
             # remember this, so we can tell when it is complete
             self.__response = response
index b4969bddd03f871c26606585bb6ad39ba2bf147a..0082e7656e2084bafa43b7467716ab540feacc66 100644 (file)
@@ -139,8 +139,6 @@ 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
@@ -159,7 +157,6 @@ 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:
index 1f1caee8e77dfdd4c2ccc98176f4bead0a4c8501..3489240c8a0857bfed78f59ad11d2fcd4448aaf5 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -199,6 +199,8 @@ Core and builtins
 Library
 -------
 
+- Bug #978833: Revert r50844, as it broke _socketobject.dup.
+
 - Bug #1675967: re patterns pickled with Python 2.4 and earlier can
   now be unpickled with Python 2.5 and newer.