summaryrefslogtreecommitdiffstats
path: root/Lib/ssl.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-12-06 18:39:46 (GMT)
committerGuido van Rossum <guido@python.org>2007-12-06 18:39:46 (GMT)
commit03b5c9ae7587cfac1c1b6be22ee5d2f7f854d68b (patch)
tree6c5c05a61cfd11b45fa7de1b0c9c2153d71aeb4c /Lib/ssl.py
parent4b28041530ce2dc8f741d544b6f86627348de3ef (diff)
downloadcpython-03b5c9ae7587cfac1c1b6be22ee5d2f7f854d68b.zip
cpython-03b5c9ae7587cfac1c1b6be22ee5d2f7f854d68b.tar.gz
cpython-03b5c9ae7587cfac1c1b6be22ee5d2f7f854d68b.tar.bz2
Fix the leaks in test_ssl. Issue 1469. Patch by Christian Heimes:
(a) added GC support to the PySSL object (b) move the call to _real_close() from __del__ methods in Python to PySSL_dealloc(). (c) remove those __del__ methods -- this makes SSL and socket objects GC'able.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r--Lib/ssl.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index be13866..a6619d6 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -148,6 +148,10 @@ class SSLSocket(socket):
self.do_handshake_on_connect = do_handshake_on_connect
self.suppress_ragged_eofs = suppress_ragged_eofs
+ # See Modules/_ssl.c:PySSL_dealloc()
+ # def __del__(self):
+ # self._real_close()
+
def dup(self):
raise NotImplemented("Can't dup() %s instances" %
self.__class__.__name__)
@@ -300,6 +304,7 @@ class SSLSocket(socket):
socket.shutdown(self, how)
def _real_close(self):
+ # real close is called by Modules/_ssl.c:PySSL_dealloc()
self._sslobj = None
# self._closed = True
if self._base:
@@ -348,10 +353,6 @@ class SSLSocket(socket):
self.do_handshake_on_connect),
addr)
-
- def __del__(self):
- self._real_close()
-
def wrap_socket(sock, keyfile=None, certfile=None,
server_side=False, cert_reqs=CERT_NONE,
ssl_version=PROTOCOL_SSLv23, ca_certs=None,