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;