diff --git a/panda/src/pstatclient/pStatClient_ext.cxx b/panda/src/pstatclient/pStatClient_ext.cxx index 9d925660c3..db4b573c26 100644 --- a/panda/src/pstatclient/pStatClient_ext.cxx +++ b/panda/src/pstatclient/pStatClient_ext.cxx @@ -12,10 +12,15 @@ */ #include "pStatClient_ext.h" + +#if defined(HAVE_PYTHON) && defined(DO_PSTATS) + #include "pStatCollector.h" #include "config_pstatclient.h" +#ifndef CPPPARSER #include "frameobject.h" +#endif #if PY_VERSION_HEX >= 0x03060000 static bool _python_profiler_enabled = false; @@ -314,8 +319,8 @@ trace_callback(PyObject *py_thread, PyFrameObject *frame, int what, PyObject *ar int thread_index = pthread.get_index(); #ifdef _DEBUG - nassertr(collector_index >= 0 && collector_index < AtomicAdjust::get(_num_collectors), -1); - nassertr(thread_index >= 0 && thread_index < AtomicAdjust::get(_num_threads), -1); + nassertr(collector_index >= 0 && collector_index < AtomicAdjust::get(client->_num_collectors), -1); + nassertr(thread_index >= 0 && thread_index < AtomicAdjust::get(client->_num_threads), -1); #endif PStatClient::Collector *collector = client->get_collector_ptr(collector_index); @@ -337,3 +342,5 @@ trace_callback(PyObject *py_thread, PyFrameObject *frame, int what, PyObject *ar return 0; } #endif // PY_VERSION_HEX + +#endif // HAVE_PYTHON && DO_PSTATS diff --git a/panda/src/pstatclient/pStatClient_ext.h b/panda/src/pstatclient/pStatClient_ext.h index 3d703917dd..216d7777b1 100644 --- a/panda/src/pstatclient/pStatClient_ext.h +++ b/panda/src/pstatclient/pStatClient_ext.h @@ -16,7 +16,7 @@ #include "dtoolbase.h" -#ifdef HAVE_PYTHON +#if defined(HAVE_PYTHON) && defined(DO_PSTATS) #include "extension.h" #include "pStatClient.h" @@ -44,6 +44,6 @@ private: #include "pStatClient_ext.I" -#endif // HAVE_PYTHON +#endif // HAVE_PYTHON && DO_PSTATS #endif // PSTATCLIENT_EXT_H