Limiting execution time of embedded Python
If I embed the Python interpreter in a C or C++ program, as in this example , is there any way to limit how long the interpreter runs for? Is there anything to stop the Python code from entering an infinite loop and thus preventing PyObject_CallObject (or equivalent) from ever returning? Similarly, if the Python code creates a new thread, is there anything to stop this thread from entering an infinite loop and running forever? Peter Brittain As you can see in the docs , PyObject_CallObject has no mechanism for limiting how long the function runs. There is also no Python C API function that I