debug
This commit is contained in:
parent
eb8c8ba8f5
commit
18b4bc00b2
|
@ -57,14 +57,22 @@ public:
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
static void** numpy_api() {
|
static void** numpy_api() {
|
||||||
void** ptr = reinterpret_cast<void**>(RTC_PLUGINS_ARRAY_API);
|
static void** api = [](){
|
||||||
|
// 强制初始化NumPy
|
||||||
// 深度验证API有效性
|
if (_import_array() < 0) {
|
||||||
if (!ptr || !ptr[93]) { // 93是PyArray_SimpleNew的偏移量
|
|
||||||
PyErr_Print();
|
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 ptr;
|
||||||
|
}();
|
||||||
|
return api;
|
||||||
}
|
}
|
||||||
RTCContext(const RTCContext&) = delete;
|
RTCContext(const RTCContext&) = delete;
|
||||||
RTCContext& operator=(const RTCContext&) = delete;
|
RTCContext& operator=(const RTCContext&) = delete;
|
||||||
|
|
Loading…
Reference in New Issue