Gentoo Archives: gentoo-commits

From: Arthur Zamarin <arthurzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/greenlet/files/
Date: Sat, 01 Oct 2022 17:47:52
Message-Id: 1664646461.5f0eec65cd144c77ecf31743fe5a5ea3127c583d.arthurzam@gentoo
1 commit: 5f0eec65cd144c77ecf31743fe5a5ea3127c583d
2 Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at>
3 AuthorDate: Sat Oct 1 12:15:38 2022 +0000
4 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 1 17:47:41 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f0eec65
7
8 dev-python/greenlet: remove unused patch(es)
9
10 Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
11 Closes: https://github.com/gentoo/gentoo/pull/27556
12 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
13
14 .../greenlet/files/greenlet-1.1.2-fix-py3.11.patch | 223 ---------------------
15 1 file changed, 223 deletions(-)
16
17 diff --git a/dev-python/greenlet/files/greenlet-1.1.2-fix-py3.11.patch b/dev-python/greenlet/files/greenlet-1.1.2-fix-py3.11.patch
18 deleted file mode 100644
19 index 475fcd82fb34..000000000000
20 --- a/dev-python/greenlet/files/greenlet-1.1.2-fix-py3.11.patch
21 +++ /dev/null
22 @@ -1,223 +0,0 @@
23 -From: Victor Stinner <vstinner@××××××.org>
24 -Subject: [PATCH] Closes #305: Add Python 3.11 support
25 -
26 -* Add GREENLET_PY311 macro
27 -* PyGreenlet structure:
28 -
29 - * Add 3 members for the "data stack": 'datastack_chunk',
30 - 'datastack_top' and 'datastack_limit'.
31 - * Add 'current_frame' member.
32 -
33 -* Rename CFrame to _PyCFrame
34 -* tox.ini: Add py311 environment.
35 -
36 -Changes partially backport from the master branch:
37 -commit 63e1099acc3677e614532bea0fa2e1967b69125f.
38 -
39 -Co-Authored-By: Miro Hrončok <miro@×××××××.cz>
40 -
41 -https://github.com/python-greenlet/greenlet/pull/306
42 ---- a/src/greenlet/greenlet.c
43 -+++ b/src/greenlet/greenlet.c
44 -@@ -170,9 +170,11 @@ green_clear_exc(PyGreenlet* g)
45 - {
46 - #if GREENLET_PY37
47 - g->exc_info = NULL;
48 -- g->exc_state.exc_type = NULL;
49 - g->exc_state.exc_value = NULL;
50 -+#if !GREENLET_PY311
51 -+ g->exc_state.exc_type = NULL;
52 - g->exc_state.exc_traceback = NULL;
53 -+#endif
54 - g->exc_state.previous_item = NULL;
55 - #else
56 - g->exc_type = NULL;
57 -@@ -525,8 +527,13 @@ g_switchstack(void)
58 - { /* save state */
59 - PyGreenlet* current = ts_current;
60 - PyThreadState* tstate = PyThreadState_GET();
61 -+#if GREENLET_PY311
62 -+ current->recursion_depth = (tstate->recursion_limit
63 -+ - tstate->recursion_remaining);
64 -+#else
65 - current->recursion_depth = tstate->recursion_depth;
66 - current->top_frame = tstate->frame;
67 -+#endif
68 - #if GREENLET_PY37
69 - current->context = tstate->context;
70 - #endif
71 -@@ -551,6 +558,15 @@ g_switchstack(void)
72 - */
73 - current->cframe = tstate->cframe;
74 - ts__g_switchstack_use_tracing = tstate->cframe->use_tracing;
75 -+#if GREENLET_PY311
76 -+ current->current_frame = tstate->cframe->current_frame;
77 -+ current->datastack_chunk = tstate->datastack_chunk;
78 -+ current->datastack_top = tstate->datastack_top;
79 -+ current->datastack_limit = tstate->datastack_limit;
80 -+ PyFrameObject *frame = PyThreadState_GetFrame(tstate);
81 -+ Py_XDECREF(frame); /* PyThreadState_GetFrame gives us a new reference. */
82 -+ current->top_frame = frame;
83 -+#endif
84 - #endif
85 - }
86 -
87 -@@ -574,9 +590,6 @@ g_switchstack(void)
88 - PyGreenlet* target = ts_target;
89 - PyGreenlet* origin = ts_current;
90 - PyThreadState* tstate = PyThreadState_GET();
91 -- tstate->recursion_depth = target->recursion_depth;
92 -- tstate->frame = target->top_frame;
93 -- target->top_frame = NULL;
94 -
95 - #if GREENLET_PY37
96 - tstate->context = target->context;
97 -@@ -607,7 +620,18 @@ g_switchstack(void)
98 - */
99 - tstate->cframe->use_tracing = ts__g_switchstack_use_tracing;
100 - #endif
101 --
102 -+#if GREENLET_PY311
103 -+ tstate->recursion_remaining = (tstate->recursion_limit
104 -+ - target->recursion_depth);
105 -+ tstate->cframe->current_frame = target->current_frame;
106 -+ tstate->datastack_chunk = target->datastack_chunk;
107 -+ tstate->datastack_top = target->datastack_top;
108 -+ tstate->datastack_limit = target->datastack_limit;
109 -+#else
110 -+ tstate->recursion_depth = target->recursion_depth;
111 -+ tstate->frame = target->top_frame;
112 -+#endif
113 -+ target->top_frame = NULL;
114 - assert(ts_origin == NULL);
115 - Py_INCREF(target);
116 - ts_current = target;
117 -@@ -810,7 +834,7 @@ static int GREENLET_NOINLINE(g_initialstub)(void* mark)
118 - We want to defer copying the state info until we're sure
119 - we need it and are in a stable place to do so.
120 - */
121 -- CFrame trace_info;
122 -+ _PyCFrame trace_info;
123 - #endif
124 - /* save exception in case getattr clears it */
125 - PyErr_Fetch(&exc, &val, &tb);
126 -@@ -875,7 +899,12 @@ static int GREENLET_NOINLINE(g_initialstub)(void* mark)
127 - }
128 - self->top_frame = NULL;
129 - green_clear_exc(self);
130 -+#if GREENLET_PY311
131 -+ self->recursion_depth = (PyThreadState_GET()->recursion_limit
132 -+ - PyThreadState_GET()->recursion_remaining);
133 -+#else
134 - self->recursion_depth = PyThreadState_GET()->recursion_depth;
135 -+#endif
136 -
137 - /* restore arguments in case they are clobbered */
138 - ts_target = self;
139 -@@ -1006,13 +1035,13 @@ green_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
140 - it uses the ``root_cframe`` just to have something to put there.
141 - However, once the greenlet is actually switched to for the first
142 - time, ``g_initialstub`` (which doesn't actually "return" while the
143 -- greenlet is running) stores a new CFrame on its local stack, and
144 -+ greenlet is running) stores a new _PyCFrame on its local stack, and
145 - copies the appropriate values from the currently running CFrame;
146 -- this is then made the CFrame for the newly-minted greenlet.
147 -+ this is then made the _PyCFrame for the newly-minted greenlet.
148 - ``g_initialstub`` then proceeds to call ``glet.run()``, which
149 -- results in ``PyEval_...`` adding the CFrame to the list. Switches
150 -+ results in ``PyEval_...`` adding the _PyCFrame to the list. Switches
151 - continue as normal. Finally, when the greenlet finishes, the call to
152 -- ``glet.run()`` returns and the CFrame is taken out of the linked
153 -+ ``glet.run()`` returns and the _PyCFrame is taken out of the linked
154 - list and the stack value is now unused and free to expire.
155 - */
156 - ((PyGreenlet*)o)->cframe = &PyThreadState_GET()->root_cframe;
157 -@@ -1121,9 +1150,11 @@ green_traverse(PyGreenlet* self, visitproc visit, void* arg)
158 - Py_VISIT(self->context);
159 - #endif
160 - #if GREENLET_PY37
161 -- Py_VISIT(self->exc_state.exc_type);
162 - Py_VISIT(self->exc_state.exc_value);
163 -+#if !GREENLET_PY311
164 -+ Py_VISIT(self->exc_state.exc_type);
165 - Py_VISIT(self->exc_state.exc_traceback);
166 -+#endif
167 - #else
168 - Py_VISIT(self->exc_type);
169 - Py_VISIT(self->exc_value);
170 -@@ -1159,9 +1190,11 @@ green_clear(PyGreenlet* self)
171 - Py_CLEAR(self->context);
172 - #endif
173 - #if GREENLET_PY37
174 -- Py_CLEAR(self->exc_state.exc_type);
175 - Py_CLEAR(self->exc_state.exc_value);
176 -+#if !GREENLET_PY311
177 -+ Py_CLEAR(self->exc_state.exc_type);
178 - Py_CLEAR(self->exc_state.exc_traceback);
179 -+#endif
180 - #else
181 - Py_CLEAR(self->exc_type);
182 - Py_CLEAR(self->exc_value);
183 -@@ -1253,9 +1286,11 @@ green_dealloc(PyGreenlet* self)
184 - Py_CLEAR(self->context);
185 - #endif
186 - #if GREENLET_PY37
187 -- Py_CLEAR(self->exc_state.exc_type);
188 - Py_CLEAR(self->exc_state.exc_value);
189 -+#if !GREENLET_PY311
190 -+ Py_CLEAR(self->exc_state.exc_type);
191 - Py_CLEAR(self->exc_state.exc_traceback);
192 -+#endif
193 - #else
194 - Py_CLEAR(self->exc_type);
195 - Py_CLEAR(self->exc_value);
196 ---- a/src/greenlet/greenlet.h
197 -+++ b/src/greenlet/greenlet.h
198 -@@ -14,6 +14,15 @@ extern "C" {
199 - /* This is deprecated and undocumented. It does not change. */
200 - #define GREENLET_VERSION "1.0.0"
201 -
202 -+#if PY_VERSION_HEX >= 0x30B00A6
203 -+# define GREENLET_PY311 1
204 -+ /* _PyInterpreterFrame moved to the internal C API in Python 3.11 */
205 -+# include <internal/pycore_frame.h>
206 -+#else
207 -+# define GREENLET_PY311 0
208 -+# define _PyCFrame CFrame
209 -+#endif
210 -+
211 - typedef struct _greenlet {
212 - PyObject_HEAD
213 - char* stack_start;
214 -@@ -25,6 +34,12 @@ typedef struct _greenlet {
215 - PyObject* run_info;
216 - struct _frame* top_frame;
217 - int recursion_depth;
218 -+#if GREENLET_PY311
219 -+ _PyInterpreterFrame *current_frame;
220 -+ _PyStackChunk *datastack_chunk;
221 -+ PyObject **datastack_top;
222 -+ PyObject **datastack_limit;
223 -+#endif
224 - PyObject* weakreflist;
225 - #if PY_VERSION_HEX >= 0x030700A3
226 - _PyErr_StackItem* exc_info;
227 -@@ -39,7 +54,7 @@ typedef struct _greenlet {
228 - PyObject* context;
229 - #endif
230 - #if PY_VERSION_HEX >= 0x30A00B1
231 -- CFrame* cframe;
232 -+ _PyCFrame* cframe;
233 - #endif
234 - } PyGreenlet;
235 -
236 ---- a/tox.ini
237 -+++ b/tox.ini
238 -@@ -1,6 +1,6 @@
239 - [tox]
240 - envlist =
241 -- py27,py35,py36,py37,py38,py39,py310,docs
242 -+ py27,py35,py36,py37,py38,py39,py310,py311,docs
243 -
244 - [testenv]
245 - commands =