[pypy-dev] [mdione at grulic.org.ar: modifying locals]
mdione at grulic.org.ar
Wed Oct 14 12:58:47 CEST 2015
Forwarding as suggested in python-list...
----- Forwarded message from Marcos Dione <mdione at grulic.org.ar> -----
Date: Sun, 11 Oct 2015 15:30:05 +0200
From: Marcos Dione <mdione at grulic.org.ar>
Subject: modifying locals
To: help at python.org
Message-ID: <20151011133005.GC2798 at diablo.grulicueva.local>
Content-Type: text/plain; charset=us-ascii
First of all, I'm not subscribed to the list, so please CC me.
I'm writing a language heavily based on Python. The way I'm
implementing it is by having my own parser (based/stolen from pypy),
obtaining an AST, modifying it and running the result with Python3's
One of its particular features is that I intend to support
semi-transparent remote execution using paramiko. For that, there is a
construction that looks like this:
[local code 1]
[local code 2]
The idea is that [remote code] is effectively executed in a remote
machine specified in remote()'s parameters. This is implemented by
remote() being a context manager. Part of the transparency is that
globals and locals at the remote() point will be accesible to the remote
code (so far only variables), and that modifications to locals will be
visible back to [local code 2].
So far I managed to do the first part, but not the second. I managed
to transfer the locals back from the remote. My problem is modifying the
locals in remote()'s __exit__() method. As I'm running the code using
exec(), it's not just a matter of modifying locals().
What I tried was the following:
* When I execute the code, I pass an empty dictionary to hold the locals.
I save a reference to it, and I try to use it to modify the locals
[local code 2] sees, but as locals are related to stack frame, it
* This leads to the second attempt: use the stack to modify remote()'s
caller's locals by:
Somehow this doesn't work either, and it's driving me crazy.
I run out of ideas, so maybe you could throw some? Thanks in
 if you're interested, check https://github.com/StyXman/ayrton/
 isn't it? Just by writing that I got my doubts...
(Not so) Random fortune:
They called me mad, and I called them mad, and damn them, they outvoted me.
-- Nathaniel Lee
----- End forwarded message -----
(Not so) Random fortune:
20:45 < perrito666> la_rayis: la esperanza es lo ultimo que se pierde
20:45 * perrito666 se aferra a eso o ya estaria casado
More information about the pypy-dev