mdrubin / pythoninthebrowser

Automatically exported from code.google.com/p/pythoninthebrowser
0 stars 0 forks source link

Can 't detect or break infinite loops #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There is no way to detect or break an infinite loop. e.g.:

while True:
 pass

Original issue reported on code.google.com by fuzzyman on 15 Jun 2008 at 12:46

GoogleCodeExporter commented 8 years ago
One solution to this, that wouldn't block the browser whilst Python code is 
being
executed, would be to execute the code on a background thread.

This would enable us to interrupt running code with a ctrl-c as well.

It introduces complexity in handling of new input whilst code is still running. 

An additional detail is that output to stdout from a background thread needs to 
be
invoked onto the UI thread. THis can be done inside the 'write' method of the 
mock
stdout.

Original comment by fuzzyman on 15 Jun 2008 at 1:43

GoogleCodeExporter commented 8 years ago
Another advantage is that executing Python code wouldn't block the browser - 
which
would be nice.

Original comment by fuzzyman on 17 Jun 2008 at 4:45