| 523 | } |
| 524 | |
| 525 | bool PythonContext::CheckInterfaces(rdcstr &log) |
| 526 | { |
| 527 | bool errors = false; |
| 528 | |
| 529 | PyGILState_STATE gil = PyGILState_Ensure(); |
| 530 | errors |= CheckCoreInterface(log); |
| 531 | errors |= CheckQtInterface(log); |
| 532 | |
| 533 | for(rdcstr module_name : {"renderdoc", "qrenderdoc"}) |
| 534 | { |
| 535 | PyObject *mod = PyImport_ImportModule(module_name.c_str()); |
| 536 | PyObject *dict = PyModule_GetDict(mod); |
| 537 | |
| 538 | PyObject *key, *value; |
| 539 | Py_ssize_t pos = 0; |
| 540 | |
| 541 | while(PyDict_Next(dict, &pos, &key, &value)) |
| 542 | { |
| 543 | rdcstr name = ToQStr(key); |
| 544 | |
| 545 | if(name.beginsWith("__")) |
| 546 | continue; |
| 547 | |
| 548 | if(!PyCallable_Check(value)) |
| 549 | { |
| 550 | log += "Non-callable object found: " + module_name + "." + name + |
| 551 | ". Expected only classes and functions.\n"; |
| 552 | errors = true; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | Py_DECREF(mod); |
| 557 | } |
| 558 | |
| 559 | PyGILState_Release(gil); |
| 560 | |
| 561 | log.trim(); |
| 562 | return errors; |
| 563 | } |
| 564 | |
| 565 | void PythonContext::Finish() |
| 566 | { |
no test coverage detected