commit: ba21d61bf2fd7912252e10ecff3e03f735a78855
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 9 23:34:56 2021 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Feb 9 23:38:41 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba21d61b
dev-python/pypy3: Backport servername_callback fix
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/pypy3/files/7.3.3_p37-sni-handle.patch | 38 ++++++++++++++++++++++
...-7.3.3_p37.ebuild => pypy3-7.3.3_p37-r1.ebuild} | 4 ++-
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/dev-python/pypy3/files/7.3.3_p37-sni-handle.patch
b/dev-python/pypy3/files/7.3.3_p37-sni-handle.patch
new file mode 100644
index 00000000000..c4e377c3d8d
--- /dev/null
+++ b/dev-python/pypy3/files/7.3.3_p37-sni-handle.patch
@@ -0,0 +1,38 @@
+diff -dupr a/lib_pypy/_cffi_ssl/_stdssl/__init__.py
b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
+--- a/lib_pypy/_cffi_ssl/_stdssl/__init__.py 2021-02-10 00:15:40.815208732
+0100
++++ b/lib_pypy/_cffi_ssl/_stdssl/__init__.py 2021-02-10 00:19:27.963109365
+0100
+@@ -1008,10 +1008,10 @@ for name in SSL_CTX_STATS_NAMES:
+ SSL_CTX_STATS.append((name, getattr(lib, attr)))
+
+ class _SSLContext(object):
+- __slots__ = ('ctx', '_check_hostname', 'servername_callback',
++ __slots__ = ('ctx', '_check_hostname',
+ 'alpn_protocols', '_alpn_protocols_handle', '_protocol'
+ 'npn_protocols', 'set_hostname', '_post_handshake_auth',
+- '_sni_cb', '_npn_protocols_handle')
++ '_sni_cb', '_sni_cb_handle', '_npn_protocols_handle')
+ def __new__(cls, protocol):
+ self = object.__new__(cls)
+ self.ctx = ffi.NULL
+@@ -1451,15 +1451,17 @@ class _SSLContext(object):
+ "is not in the current OpenSSL library.")
+ if cb is None:
+ lib.SSL_CTX_set_tlsext_servername_callback(self.ctx, ffi.NULL)
+- self._sni_cb= None
++ self._sni_cb = None
++ lib.SSL_CTX_set_tlsext_servername_arg(self.ctx, ffi.NULL)
++ self._sni_cb_handle = None
+ return
+ if not callable(cb):
+ lib.SSL_CTX_set_tlsext_servername_callback(self.ctx, ffi.NULL)
+ raise TypeError("not a callable object")
+- self.scb = ServernameCallback(cb, self)
+- sni_cb = ffi.new_handle(self.scb)
++ self._sni_cb = ServernameCallback(cb, self)
++ self._sni_cb_handle = ffi.new_handle(self._sni_cb)
+ lib.SSL_CTX_set_tlsext_servername_callback(self.ctx,
_servername_callback)
+- lib.SSL_CTX_set_tlsext_servername_arg(self.ctx, sni_cb)
++ lib.SSL_CTX_set_tlsext_servername_arg(self.ctx, self._sni_cb_handle)
+
+ def cert_store_stats(self):
+ store = lib.SSL_CTX_get_cert_store(self.ctx)
diff --git a/dev-python/pypy3/pypy3-7.3.3_p37.ebuild
b/dev-python/pypy3/pypy3-7.3.3_p37-r1.ebuild
similarity index 97%
rename from dev-python/pypy3/pypy3-7.3.3_p37.ebuild
rename to dev-python/pypy3/pypy3-7.3.3_p37-r1.ebuild
index 9c1fc7d860b..a5d9d3cf0aa 100644
--- a/dev-python/pypy3/pypy3-7.3.3_p37.ebuild
+++ b/dev-python/pypy3/pypy3-7.3.3_p37-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -50,6 +50,8 @@ src_prepare() {
eapply "${FILESDIR}/7.3.1-gentoo-path.patch"
eapply
"${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
eapply "${FILESDIR}/7.3.2-py37-distutils-cxx.patch"
+ # https://foss.heptapod.net/pypy/pypy/-/issues/3396
+ eapply "${FILESDIR}/7.3.3_p37-sni-handle.patch"
sed -e "s^@EPREFIX@^${EPREFIX}^" \
-i lib-python/3/distutils/command/install.py || die