Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/greenlet/files/, dev-python/greenlet/
Date: Tue, 26 May 2020 18:09:57
Message-Id: 1590516584.c124ccfb11cdde96a4936b887f3e5e3278fdb982.mgorny@gentoo
1 commit: c124ccfb11cdde96a4936b887f3e5e3278fdb982
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 26 17:00:52 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue May 26 18:09:44 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c124ccfb
7
8 dev-python/greenlet: Port to py39
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../greenlet/files/greenlet-0.4.15-py39.patch | 48 ++++++++++++++++++++++
13 dev-python/greenlet/greenlet-0.4.15-r1.ebuild | 5 +--
14 2 files changed, 50 insertions(+), 3 deletions(-)
15
16 diff --git a/dev-python/greenlet/files/greenlet-0.4.15-py39.patch b/dev-python/greenlet/files/greenlet-0.4.15-py39.patch
17 new file mode 100644
18 index 00000000000..15cf75d32e5
19 --- /dev/null
20 +++ b/dev-python/greenlet/files/greenlet-0.4.15-py39.patch
21 @@ -0,0 +1,48 @@
22 +From d05b62bb75e6a3e217435a1fe0f15a53e692898c Mon Sep 17 00:00:00 2001
23 +From: Victor Stinner <vstinner@××××××.org>
24 +Date: Wed, 18 Mar 2020 15:09:33 +0100
25 +Subject: [PATCH] Port to Python 3.9
26 +
27 +On Python 3.9, define _Py_DEC_REFTOTAL which has been removed by:
28 +https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924
29 +
30 +Replace also PyEval_CallObjectWithKeywords() with PyObject_Call(),
31 +since PyEval_CallObjectWithKeywords() has been deprecated in
32 +Python 3.9 and PyObject_Call() has the same behavior. The only
33 +difference is that PyEval_CallObjectWithKeywords() can be called with
34 +args=NULL, but g_initialstub() ensures that args is not NULL.
35 +---
36 + greenlet.c | 13 +++++++++++--
37 + 1 file changed, 11 insertions(+), 2 deletions(-)
38 +
39 +diff --git a/greenlet.c b/greenlet.c
40 +index ec738b9..d37fc97 100644
41 +--- a/greenlet.c
42 ++++ b/greenlet.c
43 +@@ -109,6 +109,16 @@ extern PyTypeObject PyGreenlet_Type;
44 + #define GREENLET_USE_TRACING 1
45 + #endif
46 +
47 ++#ifndef _Py_DEC_REFTOTAL
48 ++ /* _Py_DEC_REFTOTAL macro has been removed from Python 3.9 by:
49 ++ https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924 */
50 ++# ifdef Py_REF_DEBUG
51 ++# define _Py_DEC_REFTOTAL _Py_RefTotal--
52 ++# else
53 ++# define _Py_DEC_REFTOTAL
54 ++# endif
55 ++#endif
56 ++
57 + /* Weak reference to the switching-to greenlet during the slp switch */
58 + static PyGreenlet* volatile ts_target = NULL;
59 + /* Strong reference to the switching from greenlet after the switch */
60 +@@ -820,8 +830,7 @@ static int GREENLET_NOINLINE(g_initialstub)(void* mark)
61 + result = NULL;
62 + } else {
63 + /* call g.run(*args, **kwargs) */
64 +- result = PyEval_CallObjectWithKeywords(
65 +- run, args, kwargs);
66 ++ result = PyObject_Call(run, args, kwargs);
67 + Py_DECREF(args);
68 + Py_XDECREF(kwargs);
69 + }
70
71 diff --git a/dev-python/greenlet/greenlet-0.4.15-r1.ebuild b/dev-python/greenlet/greenlet-0.4.15-r1.ebuild
72 index 3773da08c6e..5d9f0a2d2be 100644
73 --- a/dev-python/greenlet/greenlet-0.4.15-r1.ebuild
74 +++ b/dev-python/greenlet/greenlet-0.4.15-r1.ebuild
75 @@ -4,7 +4,7 @@
76 EAPI=7
77
78 # Note: greenlet is built-in in pypy
79 -PYTHON_COMPAT=( python2_7 python3_{6,7,8} )
80 +PYTHON_COMPAT=( python2_7 python3_{6,7,8,9} )
81
82 inherit distutils-r1 flag-o-matic
83
84 @@ -17,10 +17,9 @@ SLOT="0"
85 KEYWORDS="~alpha ~amd64 ~arm ~arm64 -hppa -ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
86 IUSE="doc"
87
88 -BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
89 -
90 PATCHES=(
91 "${FILESDIR}"/${P}-Add-support-for-DEC-Alpha.patch
92 + "${FILESDIR}"/greenlet-0.4.15-py39.patch
93 )
94
95 DISTUTILS_IN_SOURCE_BUILD=1