Am 21.02.2015 um 00:37 schrieb Jason Moore:
> Maybe this:
>
http://stackoverflow.com/questions/366682/how-to-limit-execution-time-of-a-function-call-in-python
The caveat is important: "Not sure how cross-platform that is."
AFAIK signals and alarms do not work under Windows.
You can move the function call into a separate process and kill the
subprocess if it takes too long. I know of no readymade recipe for that,
except that one could extract it from SymPy's testing framework which
does exactly this.
The other approach would be to use multithreading, but that's not an
option for CPython (too fragile, interpreter isn't really built for
that); one could use that in Jython, Stackless, or probably pypy, and
even then, there are things that won't get cleaned up properly if one
thread interrupts another.