1 |
commit: 2ff590874366fb7e656a88293e19fa4bacd2e489 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 28 07:27:18 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jul 28 09:19:04 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ff59087 |
7 |
|
8 |
dev-python/uvloop: Attempt fixing 64-bit thread id problems |
9 |
|
10 |
The upstream hack for 32-bit platforms seems to cause OverflowErrors |
11 |
on 64-bit platforms with large Python thread identifiers (e.g. sparc). |
12 |
Let's attempt reverting the patch and see how uvloop fares without it |
13 |
on Gentoo-supported platforms. |
14 |
|
15 |
Bug: https://bugs.gentoo.org/796803 |
16 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
17 |
|
18 |
.../files/uvloop-0.15.3-uint64-thread-id.patch | 43 +++++++++++++++ |
19 |
dev-python/uvloop/uvloop-0.15.3-r1.ebuild | 63 ++++++++++++++++++++++ |
20 |
2 files changed, 106 insertions(+) |
21 |
|
22 |
diff --git a/dev-python/uvloop/files/uvloop-0.15.3-uint64-thread-id.patch b/dev-python/uvloop/files/uvloop-0.15.3-uint64-thread-id.patch |
23 |
new file mode 100644 |
24 |
index 00000000000..a74fedd308e |
25 |
--- /dev/null |
26 |
+++ b/dev-python/uvloop/files/uvloop-0.15.3-uint64-thread-id.patch |
27 |
@@ -0,0 +1,43 @@ |
28 |
+From 732df28f0739d84c687d3e6d81995dafa18ac775 Mon Sep 17 00:00:00 2001 |
29 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
30 |
+Date: Wed, 28 Jul 2021 09:21:00 +0200 |
31 |
+Subject: [PATCH] Revert 32-bit thread ID hack |
32 |
+ |
33 |
+Apparently the hack used to fix 32-bit platforms actually breaks 64-bit |
34 |
+platforms using large thread IDs (e.g. sparc). |
35 |
+ |
36 |
+Reverts: b5b4abb16ba558cf957cf40120dfd4937c53aea5 |
37 |
+--- |
38 |
+ uvloop/includes/stdlib.pxi | 2 +- |
39 |
+ uvloop/loop.pyx | 2 +- |
40 |
+ 2 files changed, 2 insertions(+), 2 deletions(-) |
41 |
+ |
42 |
+diff --git a/uvloop/includes/stdlib.pxi b/uvloop/includes/stdlib.pxi |
43 |
+index adf9806..21d69e6 100644 |
44 |
+--- a/uvloop/includes/stdlib.pxi |
45 |
++++ b/uvloop/includes/stdlib.pxi |
46 |
+@@ -135,7 +135,7 @@ cdef int ssl_SSL_ERROR_WANT_READ = ssl.SSL_ERROR_WANT_READ |
47 |
+ cdef int ssl_SSL_ERROR_WANT_WRITE = ssl.SSL_ERROR_WANT_WRITE |
48 |
+ cdef int ssl_SSL_ERROR_SYSCALL = ssl.SSL_ERROR_SYSCALL |
49 |
+ |
50 |
+-cdef uint64_t MAIN_THREAD_ID = <uint64_t><int64_t>threading.main_thread().ident |
51 |
++cdef uint64_t MAIN_THREAD_ID = <uint64_t>threading.main_thread().ident |
52 |
+ cdef threading_Thread = threading.Thread |
53 |
+ |
54 |
+ cdef int subprocess_PIPE = subprocess.PIPE |
55 |
+diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx |
56 |
+index d9b5aaa..96c9cde 100644 |
57 |
+--- a/uvloop/loop.pyx |
58 |
++++ b/uvloop/loop.pyx |
59 |
+@@ -707,7 +707,7 @@ cdef class Loop: |
60 |
+ return |
61 |
+ |
62 |
+ cdef uint64_t thread_id |
63 |
+- thread_id = <uint64_t><int64_t>PyThread_get_thread_ident() |
64 |
++ thread_id = <uint64_t>PyThread_get_thread_ident() |
65 |
+ |
66 |
+ if thread_id != self._thread_id: |
67 |
+ raise RuntimeError( |
68 |
+-- |
69 |
+2.32.0 |
70 |
+ |
71 |
|
72 |
diff --git a/dev-python/uvloop/uvloop-0.15.3-r1.ebuild b/dev-python/uvloop/uvloop-0.15.3-r1.ebuild |
73 |
new file mode 100644 |
74 |
index 00000000000..41047739fb7 |
75 |
--- /dev/null |
76 |
+++ b/dev-python/uvloop/uvloop-0.15.3-r1.ebuild |
77 |
@@ -0,0 +1,63 @@ |
78 |
+# Copyright 1999-2021 Gentoo Authors |
79 |
+# Distributed under the terms of the GNU General Public License v2 |
80 |
+ |
81 |
+EAPI=8 |
82 |
+ |
83 |
+PYTHON_COMPAT=( python3_{8..9} ) |
84 |
+inherit distutils-r1 |
85 |
+ |
86 |
+DESCRIPTION="Ultra-fast implementation of asyncio event loop on top of libuv" |
87 |
+HOMEPAGE="https://github.com/magicstack/uvloop" |
88 |
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" |
89 |
+ |
90 |
+KEYWORDS="~amd64" |
91 |
+LICENSE="MIT" |
92 |
+SLOT="0" |
93 |
+IUSE="doc examples" |
94 |
+ |
95 |
+RDEPEND=">=dev-libs/libuv-1.11.0:=" |
96 |
+DEPEND="${RDEPEND}" |
97 |
+BDEPEND=" |
98 |
+ dev-python/cython[${PYTHON_USEDEP}] |
99 |
+ doc? ( |
100 |
+ >=dev-python/alabaster-0.6.2[${PYTHON_USEDEP}] |
101 |
+ dev-python/sphinx[${PYTHON_USEDEP}] |
102 |
+ ) |
103 |
+ test? ( |
104 |
+ dev-python/aiohttp[${PYTHON_USEDEP}] |
105 |
+ dev-python/pyopenssl[${PYTHON_USEDEP}] |
106 |
+ dev-python/psutil[${PYTHON_USEDEP}] |
107 |
+ ) |
108 |
+" |
109 |
+ |
110 |
+distutils_enable_tests setup.py |
111 |
+ |
112 |
+PATCHES=( |
113 |
+ "${FILESDIR}"/${P}-uint64-thread-id.patch |
114 |
+) |
115 |
+ |
116 |
+python_prepare_all() { |
117 |
+ cat <<EOF >> setup.cfg || die |
118 |
+[build_ext] |
119 |
+use-system-libuv=1 |
120 |
+EOF |
121 |
+ |
122 |
+ # flake8 only |
123 |
+ rm tests/test_sourcecode.py || die |
124 |
+ # TODO: broken by cythonize |
125 |
+ rm tests/test_cython.py || die |
126 |
+ # force cythonization |
127 |
+ rm uvloop/loop.c || die |
128 |
+ |
129 |
+ distutils-r1_python_prepare_all |
130 |
+} |
131 |
+ |
132 |
+python_compile_all() { |
133 |
+ use doc && esetup.py build_ext --inplace build_sphinx |
134 |
+} |
135 |
+ |
136 |
+python_install_all() { |
137 |
+ use examples && dodoc -r examples |
138 |
+ use doc && local HTML_DOCS=( "${BUILD_DIR}/sphinx/html/." ) |
139 |
+ distutils-r1_python_install_all |
140 |
+} |