From 432c13b3d1247efd59610e502181091b33baada5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=BCmer=20Cip?= <sumer.cip@platform.sh>
Date: Thu, 4 Aug 2022 13:31:20 +0300
Subject: [PATCH 03/11] fix ensure_thread_profiled
---
yappi/_yappi.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/yappi/_yappi.c b/yappi/_yappi.c
index 369e88c..00fdbd4 100644
--- a/yappi/_yappi.c
+++ b/yappi/_yappi.c
@@ -1295,12 +1295,14 @@ _resume_greenlet_ctx(_ctx *ctx)
static _ctx *
_bootstrap_thread(PyThreadState *ts)
{
-#if PY_VERSION_HEX < 0x030a00b1
- ts->use_tracing = 1;
-#else
- ts->cframe->use_tracing = 1;
-#endif
- ts->c_profilefunc = _yapp_callback;
+// #if PY_VERSION_HEX < 0x030a00b1
+// ts->use_tracing = 1;
+// #else
+// ts->cframe->use_tracing = 1;
+// #endif
+// ts->c_profilefunc = _yapp_callback;
+ PyEval_SetProfile(_yapp_callback, NULL);
+
return NULL;
}
@@ -1491,6 +1493,8 @@ _start(void)
return 0;
}
+ //flags.multicontext = 0;
+
if (flags.multicontext) {
_enum_threads(&_bootstrap_thread);
} else {
--
2.34.1