I\'m embedding Python interpreter to a C program. However, it might happen that while running some python script via PyRun_SimpleString()
will run into infinite
Well the python interpreter would have to be running in a separate thread from the embedding program or you will simply never get a chance to interrupt the interpreter.
When you have that, perhaps you can use one of the Python API exception calls to trigger an exception in the interpreter? See Python C API Exceptions