[pypy-commit] pypy release-2.2.x: Fix for SSLSocket.makefile()

alex_gaynor noreply at buildbot.pypy.org
Sun Nov 24 11:49:43 CET 2013


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: release-2.2.x
Changeset: r68303:10eb72c572ed
Date: 2013-11-21 10:09 -0800
http://bitbucket.org/pypy/pypy/changeset/10eb72c572ed/

Log:	Fix for SSLSocket.makefile()

	Test program:

	pypy -c "import socket, ssl; s =
	ssl.wrap_socket(socket.create_connection(('pypi.python.org', 443)));
	s.makefile().close(); print s.fileno()" (transplanted from
	963c6d6d7d6c8cb32d1e338ef620e9edd9e479fa)

diff --git a/lib-python/2.7/socket.py b/lib-python/2.7/socket.py
--- a/lib-python/2.7/socket.py
+++ b/lib-python/2.7/socket.py
@@ -335,9 +335,10 @@
             s = self._sock
             self._sock = None
             if s is not None:
-                s._drop()
                 if self._close:
                     s.close()
+                else:
+                    s._drop()
 
     def __del__(self):
         try:


More information about the pypy-commit mailing list