From 0ea089203c5d8638fc3adc2987ae1c31941d9d09 Mon Sep 17 00:00:00 2001 From: wangjiyu Date: Thu, 10 Apr 2025 18:41:23 +0800 Subject: [PATCH] debug --- rtc_plugins.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtc_plugins.cpp b/rtc_plugins.cpp index 37acd75..af34092 100644 --- a/rtc_plugins.cpp +++ b/rtc_plugins.cpp @@ -174,6 +174,12 @@ void init_numpy() { BOOST_PYTHON_MODULE(rtc_plugins) { try { init_numpy(); + void** numpy_api = (void**)PyArray_API; + if (!numpy_api || !numpy_api[93]) { // 93是PyArray_SimpleNew的偏移量 + std::cout << "NumPy API corrupt! Key functions missing." << std::endl; + PyErr_Print(); + throw std::runtime_error("Invalid NumPy API state"); + } if (!PyArray_API) { std::cout << "PyArray_API is null" << std::endl;