Author: Richard Plangger <planri...@gmail.com> Branch: py3.5-ssl Changeset: r88699:32c4efd0d776 Date: 2016-11-28 15:31 +0100 http://bitbucket.org/pypy/pypy/changeset/32c4efd0d776/
Log: remove review comment (created issue), call SSL_free when the CData goes out of scope, ensure that the SSL peer certificate is collected diff --git a/lib_pypy/_cffi_ssl/_stdssl/__init__.py b/lib_pypy/_cffi_ssl/_stdssl/__init__.py --- a/lib_pypy/_cffi_ssl/_stdssl/__init__.py +++ b/lib_pypy/_cffi_ssl/_stdssl/__init__.py @@ -218,7 +218,7 @@ lib.ERR_get_state() lib.ERR_clear_error() - self.ssl = ssl = lib.SSL_new(ctx) + self.ssl = ssl = lib.gc(lib.SSL_new(ctx), lib.SSL_free) self._app_data_handle = ffi.new_handle(self) lib.SSL_set_app_data(ssl, ffi.cast("char*", self._app_data_handle)) @@ -271,9 +271,6 @@ self.server_hostname = None self.socket = None - def __del__(self): - self._app_data_handle = None - @property def owner(self): if self._owner is None: @@ -348,9 +345,7 @@ if ret < 1: raise pyssl_error(self, ret) - if self.peer_cert != ffi.NULL: - lib.X509_free(self.peer_cert) - self.peer_cert = lib.SSL_get_peer_certificate(ssl) + self.peer_cert = lib.gc(lib.SSL_get_peer_certificate(ssl), lib.X509_free) #PySSL_END_ALLOW_THREADS self.handshake_done = 1 return None diff --git a/pypy/module/imp/interp_imp.py b/pypy/module/imp/interp_imp.py --- a/pypy/module/imp/interp_imp.py +++ b/pypy/module/imp/interp_imp.py @@ -9,8 +9,6 @@ def extension_suffixes(space): suffixes_w = [] - # REVIEW this condition prevents pypy/tools/build_cffi_imports.py to succeed if - # pypy was compiled without cpyext module. why nore always append it? if space.config.objspace.usemodules.cpyext: suffixes_w.append(space.wrap(importing.get_so_extension(space))) return space.newlist(suffixes_w) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit