Author: Armin Rigo <[email protected]>
Branch: use-gc-del-3
Changeset: r84239:8e99fd479ff1
Date: 2016-05-06 07:48 +0200
http://bitbucket.org/pypy/pypy/changeset/8e99fd479ff1/

Log:    Fix _ssl (probably)

diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -278,6 +278,8 @@
         sock_fd = space.int_w(space.call_method(w_sock, "fileno"))
         self.ssl = libssl_SSL_new(w_ctx.ctx)  # new ssl struct
 
+        self.register_finalizer(space)
+
         index = compute_unique_id(self)
         libssl_SSL_set_app_data(self.ssl, rffi.cast(rffi.VOIDP, index))
         SOCKET_STORAGE.set(index, self)
@@ -317,12 +319,7 @@
             self.ssl_sock_weakref_w = None
         return self
 
-    def __del__(self):
-        self.enqueue_for_destruction(self.space, _SSLSocket.destructor,
-                                     '__del__() method of ')
-
-    def destructor(self):
-        assert isinstance(self, _SSLSocket)
+    def _finalize_(self):
         if self.peer_cert:
             libssl_X509_free(self.peer_cert)
         if self.ssl:
@@ -1285,6 +1282,7 @@
         self = space.allocate_instance(_SSLContext, w_subtype)
         self.ctx = ctx
         self.check_hostname = False
+        self.register_finalizer(space)
         options = SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
         if protocol != PY_SSL_VERSION_SSL2:
             options |= SSL_OP_NO_SSLv2
@@ -1308,7 +1306,7 @@
 
         return self
 
-    def __del__(self):
+    def _finalize_(self):
         libssl_SSL_CTX_free(self.ctx)
 
     @unwrap_spec(server_side=int)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to