debug
This commit is contained in:
parent
eb8c8ba8f5
commit
18b4bc00b2
|
@ -57,14 +57,22 @@ public:
|
|||
return instance;
|
||||
}
|
||||
static void** numpy_api() {
|
||||
void** ptr = reinterpret_cast<void**>(RTC_PLUGINS_ARRAY_API);
|
||||
|
||||
// 深度验证API有效性
|
||||
if (!ptr || !ptr[93]) { // 93是PyArray_SimpleNew的偏移量
|
||||
static void** api = [](){
|
||||
// 强制初始化NumPy
|
||||
if (_import_array() < 0) {
|
||||
PyErr_Print();
|
||||
throw std::runtime_error("Invalid NumPy API structure");
|
||||
throw std::runtime_error("NumPy initialization failed");
|
||||
}
|
||||
|
||||
void** ptr = reinterpret_cast<void**>(RTC_PLUGINS_ARRAY_API);
|
||||
if (!ptr || !ptr[93]) {
|
||||
std::cerr << "NumPy API corrupt! Expected at 93: "
|
||||
<< (ptr ? (void*)ptr[93] : nullptr) << std::endl;
|
||||
abort();
|
||||
}
|
||||
return ptr;
|
||||
}();
|
||||
return api;
|
||||
}
|
||||
RTCContext(const RTCContext&) = delete;
|
||||
RTCContext& operator=(const RTCContext&) = delete;
|
||||
|
|
Loading…
Reference in New Issue