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

juliangrendell at gmail.com juliangrendell at gmail.com
Tue Nov 4 08:03:46 CET 2008

Thanks to those who replied; it seems that it is possible to do,
but would require some changes to the python core, and may not be
as fine-grained as I'd presumed.  I think I'll consider running
python in a seperate thread and create a couple of message queues
to/from that thread and the main thread.


On Nov 1, 12:46 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> juliangrend... at gmail.com writes:
> > The goal is to be able to set some limit on the amount of time in the
> > interpreter in each loop, and not rely on the python side code. ...
> > Does anyone have any suggestions for how this could be achieved?
> Not really.  Limiting the number of virtual instructions (byte codes)
> is of no help, since each one can consume unlimited runtime.  I think
> for example that bigint exponentiation is one bytecode, and 9**999999
> probably takes several seconds to compute.

More information about the Python-list mailing list