Embedding: Is it possible to limit number of virtual instructions executed?

"Martin v. Löwis" martin at v.loewis.de
Sat Nov 1 08:28:32 CET 2008


> Does anyone have any suggestions for how this could be achieved?

You'll have to adjust Python/ceval.c. Look for _Py_Ticker, which
provides some fairness for Python threads (releasing the GIL after
_Py_CheckInterval instructions). If you decrement another global
variable there, you can determine that the limit has been reached,
and raise an exception (say).

Regards,
Martin



More information about the Python-list mailing list