embedded python and endless loops

Mike Weiss WeissMike at hotmail.com
Thu Mar 6 16:35:07 EST 2003


My C++ program (a Windows-based server application) uses embedded
Python (2.2) to execute user-defined scripts. Recently end-users have
coded (by mistake) endless loops which, when run, hang my app.

Is there a way to halt the execution of the very high-level functions
like PyRun_String()? I'm thinking I could have a second thread (in my
c++ code) wait for a certain period of time (a timeout) and then
somehow stop the Python interepter? But how to stop it? (something
with a keyboard interupt?)

The solution has to work on Windows.




More information about the Python-list mailing list