blob: 48d81d56e8ba37fbf45258c1edf172b57f0171c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
From defc0291039184b640779e38471ece5e6d3c8cb8 Mon Sep 17 00:00:00 2001
From: Alfredo Moralejo <amoralej@redhat.com>
Date: Tue, 2 Jul 2024 10:48:24 +0200
Subject: [PATCH] Add support for python 3.13
_PyEval_SetProfile() has been moved to internal pycore_ceval.h and it is
not longer exported [1]. PyEval_SetProfileAllThreads was introduced in 3.12 [2].
[1] https://github.com/python/cpython/commit/c494fb333b57bdf43fc90189fc29a00c293b2987
[2] https://github.com/python/cpython/commits/76af5c9153394f3d07562427168711a68f54ec66
Upstream-Status: Backport [https://github.com/sumerc/yappi/commit/defc0291039184b640779e38471ece5e6d3c8cb8]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
yappi/_yappi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/yappi/_yappi.c b/yappi/_yappi.c
index 459f4dd..56187c9 100644
--- a/yappi/_yappi.c
+++ b/yappi/_yappi.c
@@ -1284,7 +1284,9 @@ _resume_greenlet_ctx(_ctx *ctx)
static void
_eval_setprofile(PyThreadState *ts)
{
-#if PY_VERSION_HEX > 0x030b0000
+#if PY_VERSION_HEX > 0x030c0000
+ PyEval_SetProfileAllThreads(_yapp_callback, NULL);
+#elif PY_VERSION_HEX > 0x030b0000
_PyEval_SetProfile(ts, _yapp_callback, NULL);
#elif PY_VERSION_HEX < 0x030a00b1
ts->use_tracing = 1;
@@ -1298,7 +1300,9 @@ _eval_setprofile(PyThreadState *ts)
static void
_eval_unsetprofile(PyThreadState *ts)
{
-#if PY_VERSION_HEX > 0x030b0000
+#if PY_VERSION_HEX > 0x030c0000
+ PyEval_SetProfileAllThreads(NULL, NULL);
+#elif PY_VERSION_HEX > 0x030b0000
_PyEval_SetProfile(ts, NULL, NULL);
#elif PY_VERSION_HEX < 0x030a00b1
ts->use_tracing = 0;
|