This commit is contained in:
wangjiyu 2025-04-10 18:41:23 +08:00
parent 37d164e7b4
commit 0ea089203c
1 changed files with 6 additions and 0 deletions

View File

@ -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;