MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / PP_Run_Bytecode

Function PP_Run_Bytecode

src/Base/PyTools.c:565–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563
564
565int
566PP_Run_Bytecode(PyObject *codeobj, /* run compiled bytecode object */
567 const char *modname, /* in named module's namespace */
568 const char *resfmt, void *restarget)
569{
570 PyObject *presult = NULL, *module = NULL, *dict = NULL;
571
572 if (! PyCode_Check(codeobj)) /* make sure it's bytecode */
573 return -1;
574 module = PP_Load_Module(modname); /* get module, init python */
575 if (module == NULL) /* not incref'd */
576 return -1;
577 dict = PyModule_GetDict(module); /* get dict namespace */
578 if (dict == NULL) /* not incref'd */
579 return -1;
580 if (PP_DEBUG)
581 presult = PP_Debug_Bytecode(codeobj, dict); /* run in pdb */
582 else
583 presult = PyEval_EvalCode((PyObject*)codeobj, dict, dict);
584 return PP_Convert_Result(presult, resfmt, restarget); /* expr val to C */
585}
586
587
588/**************************************************************************

Callers

nothing calls this directly

Calls 3

PP_Load_ModuleFunction · 0.85
PP_Debug_BytecodeFunction · 0.85
PP_Convert_ResultFunction · 0.85

Tested by

no test coverage detected