From bc51c5e19de10b73a47e80d8023b236a68cb7b8b Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Fri, 8 Aug 2025 11:44:09 +0800 Subject: [PATCH] Update pkpy.c --- src/modules/pkpy.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/pkpy.c b/src/modules/pkpy.c index b9ae936a..47a97e39 100644 --- a/src/modules/pkpy.c +++ b/src/modules/pkpy.c @@ -469,6 +469,9 @@ static void pkpy_configmacros_add(py_Ref dict, const char* key, int val) { static bool pkpy_profiler_begin(int argc, py_Ref argv) { PY_CHECK_ARGC(0); + if(pk_current_vm->trace_info.func != py_LineProfiler_tracefunc) { + return RuntimeError("py_LineProfiler_tracefunc() should be set as the trace function"); + } LineProfiler__begin(&pk_current_vm->line_profiler); py_newnone(py_retval()); return true;