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.

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/54E84823.3050804%40durchholz.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to