MCPcopy Create free account
hub / github.com/baldurk/renderdoc / CheckInterfaces

Method CheckInterfaces

qrenderdoc/Code/pyrenderdoc/PythonContext.cpp:525–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525bool 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
565void PythonContext::Finish()
566{

Callers 1

mainFunction · 0.80

Calls 4

ToQStrFunction · 0.70
c_strMethod · 0.45
beginsWithMethod · 0.45
trimMethod · 0.45

Tested by

no test coverage detected