blob: 6dd58ae9687b1e8db5955c34cefc358bf651de4a [file] [log] [blame]
Andrew Geisslereff27472021-10-29 15:35:00 -05001From d40bc0e8230dd35e05222f5761e3d7f7a75fd46e Mon Sep 17 00:00:00 2001
2From: Alexander Shadchin <shadchin@yandex-team.ru>
3Date: Tue, 1 Jun 2021 02:31:12 +0300
4Subject: [PATCH] Adapt to Python 3.10 beta 1
5
6Upstream-Status: Backport
7Signed-off-by: Alexander Kanavin <alex@linutronix.de>
8---
9 yappi/_yappi.c | 12 ++++++++++++
10 1 file changed, 12 insertions(+)
11
12diff --git a/yappi/_yappi.c b/yappi/_yappi.c
13index 1721280..343130d 100644
14--- a/yappi/_yappi.c
15+++ b/yappi/_yappi.c
16@@ -1258,7 +1258,11 @@ _resume_greenlet_ctx(_ctx *ctx)
17 static _ctx *
18 _bootstrap_thread(PyThreadState *ts)
19 {
20+#if PY_VERSION_HEX < 0x030a00b1
21 ts->use_tracing = 1;
22+#else
23+ ts->cframe->use_tracing = 1;
24+#endif
25 ts->c_profilefunc = _yapp_callback;
26 return NULL;
27 }
28@@ -1289,7 +1293,11 @@ _profile_thread(PyThreadState *ts)
29 ctx = (_ctx *)it->val;
30 }
31
32+#if PY_VERSION_HEX < 0x030a00b1
33 ts->use_tracing = 1;
34+#else
35+ ts->cframe->use_tracing = 1;
36+#endif
37 ts->c_profilefunc = _yapp_callback;
38 ctx->id = ctx_id;
39 ctx->tid = ts->thread_id;
40@@ -1306,7 +1314,11 @@ _profile_thread(PyThreadState *ts)
41 static _ctx*
42 _unprofile_thread(PyThreadState *ts)
43 {
44+#if PY_VERSION_HEX < 0x030a00b1
45 ts->use_tracing = 0;
46+#else
47+ ts->cframe->use_tracing = 0;
48+#endif
49 ts->c_profilefunc = NULL;
50
51 return NULL; //dummy return for enum_threads() func. prototype