Skip to content

Commit 3cdf109

Browse files
authored
Merge pull request #2673 from Lalufu/Lalufu/chore-python313-reorg
Minor rework of Python 3.13 support
2 parents 7bdd6da + 420149c commit 3cdf109

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

plugins/python/python_plugin.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,14 +1659,14 @@ void uwsgi_python_suspend(struct wsgi_request *wsgi_req) {
16591659
PyGILState_Release(pgst);
16601660

16611661
if (wsgi_req) {
1662-
#ifdef UWSGI_PY312
1662+
#ifdef UWSGI_PY313
16631663
up.current_c_recursion_remaining[wsgi_req->async_id] = tstate->c_recursion_remaining;
16641664
up.current_py_recursion_remaining[wsgi_req->async_id] = tstate->py_recursion_remaining;
1665-
#ifdef UWSGI_PY313
16661665
up.current_frame[wsgi_req->async_id] = tstate->current_frame;
1667-
#else
1666+
#elif defined UWSGI_PY312
1667+
up.current_c_recursion_remaining[wsgi_req->async_id] = tstate->c_recursion_remaining;
1668+
up.current_py_recursion_remaining[wsgi_req->async_id] = tstate->py_recursion_remaining;
16681669
up.current_frame[wsgi_req->async_id] = tstate->cframe;
1669-
#endif
16701670
#elif defined UWSGI_PY311
16711671
up.current_recursion_remaining[wsgi_req->async_id] = tstate->recursion_remaining;
16721672
up.current_frame[wsgi_req->async_id] = tstate->cframe;
@@ -1676,14 +1676,14 @@ void uwsgi_python_suspend(struct wsgi_request *wsgi_req) {
16761676
#endif
16771677
}
16781678
else {
1679-
#ifdef UWSGI_PY312
1679+
#ifdef UWSGI_PY313
16801680
up.current_main_c_recursion_remaining = tstate->c_recursion_remaining;
16811681
up.current_main_py_recursion_remaining = tstate->py_recursion_remaining;
1682-
#ifdef UWSGI_PY313
16831682
up.current_main_frame = tstate->current_frame;
1684-
#else
1683+
#elif defined UWSGI_PY312
1684+
up.current_main_c_recursion_remaining = tstate->c_recursion_remaining;
1685+
up.current_main_py_recursion_remaining = tstate->py_recursion_remaining;
16851686
up.current_main_frame = tstate->cframe;
1686-
#endif
16871687
#elif defined UWSGI_PY311
16881688
up.current_main_recursion_remaining = tstate->recursion_remaining;
16891689
up.current_main_frame = tstate->cframe;
@@ -1920,14 +1920,14 @@ void uwsgi_python_resume(struct wsgi_request *wsgi_req) {
19201920
PyGILState_Release(pgst);
19211921

19221922
if (wsgi_req) {
1923-
#ifdef UWSGI_PY312
1923+
#ifdef UWSGI_PY313
19241924
tstate->c_recursion_remaining = up.current_c_recursion_remaining[wsgi_req->async_id];
19251925
tstate->py_recursion_remaining = up.current_py_recursion_remaining[wsgi_req->async_id];
1926-
#ifdef UWSGI_PY313
19271926
tstate->current_frame = up.current_frame[wsgi_req->async_id];
1928-
#else
1927+
#elif defined UWSGI_PY312
1928+
tstate->c_recursion_remaining = up.current_c_recursion_remaining[wsgi_req->async_id];
1929+
tstate->py_recursion_remaining = up.current_py_recursion_remaining[wsgi_req->async_id];
19291930
tstate->cframe = up.current_frame[wsgi_req->async_id];
1930-
#endif
19311931
#elif defined UWSGI_PY311
19321932
tstate->recursion_remaining = up.current_recursion_remaining[wsgi_req->async_id];
19331933
tstate->cframe = up.current_frame[wsgi_req->async_id];
@@ -1937,14 +1937,14 @@ void uwsgi_python_resume(struct wsgi_request *wsgi_req) {
19371937
#endif
19381938
}
19391939
else {
1940-
#ifdef UWSGI_PY312
1940+
#ifdef UWSGI_PY313
19411941
tstate->c_recursion_remaining = up.current_main_c_recursion_remaining;
19421942
tstate->py_recursion_remaining = up.current_main_py_recursion_remaining;
1943-
#ifdef UWSGI_PY313
19441943
tstate->current_frame = up.current_main_frame;
1945-
#else
1944+
#elif defined UWSGI_PY312
1945+
tstate->c_recursion_remaining = up.current_main_c_recursion_remaining;
1946+
tstate->py_recursion_remaining = up.current_main_py_recursion_remaining;
19461947
tstate->cframe = up.current_main_frame;
1947-
#endif
19481948
#elif defined UWSGI_PY311
19491949
tstate->recursion_remaining = up.current_main_recursion_remaining;
19501950
tstate->cframe = up.current_main_frame;

plugins/python/uwsgi_python.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,22 +186,22 @@ struct uwsgi_python {
186186

187187
char *callable;
188188

189-
#ifdef UWSGI_PY312
189+
#ifdef UWSGI_PY313
190190
int *current_c_recursion_remaining;
191191
int *current_py_recursion_remaining;
192-
#ifdef UWSGI_PY313
193192
struct _PyInterpreterFrame **current_frame;
194-
#else
195-
_PyCFrame **current_frame;
196-
#endif
197193

198194
int current_main_c_recursion_remaining;
199195
int current_main_py_recursion_remaining;
200-
#ifdef UWSGI_PY313
201196
struct _PyInterpreterFrame *current_main_frame;
202-
#else
197+
#elif defined UWSGI_PY312
198+
int *current_c_recursion_remaining;
199+
int *current_py_recursion_remaining;
200+
_PyCFrame **current_frame;
201+
202+
int current_main_c_recursion_remaining;
203+
int current_main_py_recursion_remaining;
203204
_PyCFrame *current_main_frame;
204-
#endif
205205
#elif defined UWSGI_PY311
206206
int *current_recursion_remaining;
207207
_PyCFrame **current_frame;

0 commit comments

Comments
 (0)