Add support for Python 3.12
This commit is contained in:
parent
3d24ea2fd1
commit
888fd8aa93
71
0001-Add-support-for-Python-3.12.patch
Normal file
71
0001-Add-support-for-Python-3.12.patch
Normal file
@ -0,0 +1,71 @@
|
||||
From a5590bb04de3f1f201fd1fd0ce9cfe5825db80ac Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=E6=BB=95=E7=A3=8A?= Hugo van Kemenade
|
||||
Date: Thu, 9 May 2024 14:35:57 +0800
|
||||
Subject: [PATCH] Add support for Python 3.12
|
||||
|
||||
---
|
||||
README.rst | 2 +-
|
||||
curio/channel.py | 14 ++++++++++----
|
||||
curio/ssl.py | 4 ++--
|
||||
3 files changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/README.rst b/README.rst
|
||||
index 945dac8..83f9ee7 100644
|
||||
--- a/README.rst
|
||||
+++ b/README.rst
|
||||
@@ -3,7 +3,7 @@ Curio
|
||||
|
||||
Curio is a coroutine-based library for concurrent Python systems
|
||||
programming using async/await. It provides standard programming
|
||||
-abstractions such as as tasks, sockets, files, locks, and queues as
|
||||
+abstractions such as tasks, sockets, files, locks, and queues as
|
||||
well as some advanced features such as support for structured
|
||||
concurrency. It works on Unix and Windows and has zero dependencies.
|
||||
You'll find it to be familiar, small, fast, and fun.
|
||||
diff --git a/curio/channel.py b/curio/channel.py
|
||||
index 230427f..556be63 100644
|
||||
--- a/curio/channel.py
|
||||
+++ b/curio/channel.py
|
||||
@@ -28,10 +28,16 @@ from .time import timeout_after, sleep
|
||||
# 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#'
|
||||
|
||||
|
||||
class ConnectionError(CurioError):
|
||||
diff --git a/curio/ssl.py b/curio/ssl.py
|
||||
index 37efa08..4619eb1 100644
|
||||
--- a/curio/ssl.py
|
||||
+++ b/curio/ssl.py
|
||||
@@ -27,12 +27,12 @@ from .workers import run_in_thread
|
||||
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
|
||||
|
||||
- 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:
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
%global _empty_manifest_terminate_build 0
|
||||
Name: python-curio
|
||||
Version: 1.6
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Curio
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/dabeaz/curio
|
||||
@ -16,6 +16,7 @@ Summary: Curio
|
||||
Provides: python-curio = %{version}-%{release}
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
Patch0001: 0001-Add-support-for-Python-3.12.patch
|
||||
%description -n python3-curio
|
||||
Curio is a coroutine-based library for concurrent systems programming.
|
||||
|
||||
@ -26,7 +27,7 @@ Provides: python3-curio-doc
|
||||
Curio is a coroutine-based library for concurrent systems programming.
|
||||
|
||||
%prep
|
||||
%autosetup -n curio-%{version}
|
||||
%autosetup -n curio-%{version} -p1
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
@ -66,8 +67,12 @@ mv %{buildroot}/doclist.lst .
|
||||
%{_docdir}/*
|
||||
|
||||
%changelog
|
||||
* Thu May 9 2024 tenglei <tenglei@kylinos.cn> - 1.6-2
|
||||
- change-incorrect-README.rst
|
||||
- add support for python 3.12
|
||||
|
||||
* Fri Dec 16 2022 liqiuyu <liqiuyu@kylinos.cn> - 1.6-1
|
||||
- Update package to version 1.6
|
||||
|
||||
* Mon Jul 05 2021 liliang <liliang@kylinos.cn> - 1.5-1
|
||||
- Init project
|
||||
- Init project
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user