Modifying running code? [HACK ALERT]

Bjoern Giesler un4e at rzstud1.rz.uni-karlsruhe.de
Mon Dec 11 08:52:05 EST 2000


Hi,

I'm writing a kind of mini runtime environment that lets me debug / correct
buggy Python code "on the fly". This is supposed to work as follows:

1) an exception gets thrown by the buggy code and is caught by a toplevel
exception handler

2) the toplevel handler figures out the function that caused the exception

3) the function source is loaded into an editor and can be corrected by the
user

4) if the code has been saved, it is recompiled and inserted instead of the
original function

5) the program is then resumed at the point where the original function had
been called

Can this be done in Python at all? Can it be done in regular Python or only
in Stackless Python (which supports continuations and would therefore, I
believe, make step 5 easy)? Is the whole thing complete bull doodoo? Any
hints or suggestions?

Thanks in advance for any input,
		--Björn



More information about the Python-list mailing list