Browse Source

pstats: Fix assorted compile issues in more esoteric configurations

rdb 3 years ago
parent
commit
adc324bbde

+ 9 - 2
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

+ 2 - 2
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