| 315 | } |
| 316 | |
| 317 | Py::Object InterpreterSingleton::runStringObject(const char* sCmd) |
| 318 | { |
| 319 | PyObject* module {}; |
| 320 | PyObject* dict {}; |
| 321 | PyObject* presult {}; |
| 322 | |
| 323 | PyGILStateLocker locker; |
| 324 | module = PP_Load_Module("__main__"); /* get module, init python */ |
| 325 | if (!module) { |
| 326 | throw PyException(); /* not incref'd */ |
| 327 | } |
| 328 | dict = PyModule_GetDict(module); /* get dict namespace */ |
| 329 | if (!dict) { |
| 330 | throw PyException(); /* not incref'd */ |
| 331 | } |
| 332 | |
| 333 | |
| 334 | presult = PyRun_String(sCmd, Py_eval_input, dict, dict); /* eval direct */ |
| 335 | if (!presult) { |
| 336 | if (PyErr_ExceptionMatches(PyExc_SystemExit)) { |
| 337 | throw SystemExitException(); |
| 338 | } |
| 339 | |
| 340 | throw PyException(); |
| 341 | } |
| 342 | |
| 343 | return Py::asObject(presult); |
| 344 | } |
| 345 | |
| 346 | void InterpreterSingleton::systemExit() |
| 347 | { |
no test coverage detected