[Python-ideas] Isolated (?transactional) exec (?subinterpreter) calls

Terry Reedy tjreedy at udel.edu
Fri Jun 8 18:31:57 CEST 2012

On 6/8/2012 4:16 AM, anatoly techtonik wrote:

>    - it should not matter if the code is executed with command line
> interpreter or from exec(),
>      code should not be modified to successfully run in exec if it
> successfully runs in intepreter session
>      http://bugs.python.org/issue13557
>      http://bugs.python.org/issue14049
>      http://bugs.python.org/issue1167300
>      http://bugs.python.org/issue991196

These 4 duplicate issues are all about misuse of exec. The code in each 
*does* run if exec is passed just one namespace instead of two. When 
people pass two separate namespaces, the code executes as if embedded in 
a class definition. Since 'docs at python' never applied my suggested doc 
patch on 13557, I will take a stab at it.

> Optionally isolated from parent environment:
>    - a feature to execute user script in a snapshot of current
> environment and have
>      a choice whenever to merge its modifications back to environment or not

You can do at least some of that now.

Terry Jan Reedy

More information about the Python-ideas mailing list