void-packages/srcpkgs/python3-curio/patches/python3.12.patch

71 lines
2.5 KiB
Diff

From a5590bb04de3f1f201fd1fd0ce9cfe5825db80ac Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <hugovk@users.noreply.github.com>
Date: Sun, 10 Sep 2023 21:38:09 +0300
Subject: [PATCH 1/2] Add support for Python 3.12
---
curio/channel.py | 13 ++++++++++---
curio/ssl.py | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/curio/channel.py b/curio/channel.py
index 230427fb..2a54952b 100644
--- a/curio/channel.py
+++ b/curio/channel.py
@@ -28,9 +28,16 @@
# Authentication parameters (copied from multiprocessing)
AUTH_MESSAGE_LENGTH = mpc.MESSAGE_LENGTH # 20
-CHALLENGE = mpc.CHALLENGE # b'#CHALLENGE#'
-WELCOME = mpc.WELCOME # b'#WELCOME#'
-FAILURE = mpc.FAILURE # b'#FAILURE#'
+try:
+ # Python 3.12+
+ CHALLENGE = mpc._CHALLENGE # b'#CHALLENGE#'
+ WELCOME = mpc._WELCOME # b'#WELCOME#'
+ FAILURE = mpc._FAILURE # b'#FAILURE#'
+except AttributeError:
+ # Python 3.7-3.11
+ CHALLENGE = mpc.CHALLENGE # b'#CHALLENGE#'
+ WELCOME = mpc.WELCOME # b'#WELCOME#'
+ FAILURE = mpc.FAILURE # b'#FAILURE#'
diff --git a/curio/ssl.py b/curio/ssl.py
index 37efa081..12ba6a04 100644
--- a/curio/ssl.py
+++ b/curio/ssl.py
@@ -27,7 +27,7 @@ class SSLWantWriteError(Exception):
from .io import Socket
if _ssl:
- @wraps(_ssl.wrap_socket)
+ @wraps(_ssl.SSLContext.wrap_socket)
async def wrap_socket(sock, *args, do_handshake_on_connect=True, **kwargs):
if isinstance(sock, Socket):
sock = sock._socket
From 379904c4ac8cd56c1f69aec2bdd2c78b9bd046eb Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <hugovk@users.noreply.github.com>
Date: Mon, 11 Sep 2023 11:30:49 +0300
Subject: [PATCH 2/2] Add support for Python 3.12
---
curio/ssl.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/curio/ssl.py b/curio/ssl.py
index 12ba6a04..4619eb18 100644
--- a/curio/ssl.py
+++ b/curio/ssl.py
@@ -32,7 +32,7 @@ async def wrap_socket(sock, *args, do_handshake_on_connect=True, **kwargs):
if isinstance(sock, Socket):
sock = sock._socket
- ssl_sock = _ssl.wrap_socket(sock, *args, do_handshake_on_connect=False, **kwargs)
+ ssl_sock = _ssl.SSLContext.wrap_socket(sock, *args, do_handshake_on_connect=False, **kwargs)
cssl_sock = Socket(ssl_sock)
cssl_sock.do_handshake_on_connect = do_handshake_on_connect
if do_handshake_on_connect and ssl_sock._connected: