[docs] [issue9274] code.InteractiveInterpreter fails to change locals when invoked in a function

Eric Promislow report at bugs.python.org
Sat Jul 17 01:14:48 CEST 2010


Eric Promislow <ericp at activestate.com> added the comment:

Thanks for the response.

Note that our use case *is* to implement Python-console
functionality, but sometimes we do this in the context
of a currently running Python program, inside a function.
That's why I wrote the repro that way.  Using
code.InteractiveInterpreter(locals()).runsource(...)
in a function corresponds to interacting with the
debugger in a function, while the second call to
runsource() corresponds to interacting with the
program when it's stepping through top-level code.

Keep in mind that all of this takes place while
control flow of the main program is stuck in the
debugger's read-eval-print loop.

It would be useful if there was a way of accessing the
localsplus container in Python code

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9274>
_______________________________________


More information about the docs mailing list