[pypy-dev] [mdione at grulic.org.ar: modifying locals]
Marcos Dione
mdione at grulic.org.ar
Fri Oct 16 20:16:24 CEST 2015
On Fri, Oct 16, 2015 at 09:07:27AM +0200, Marcos Dione wrote:
> On Fri, Oct 16, 2015 at 08:32:36AM +0200, Armin Rigo wrote:
> > On Thu, Oct 15, 2015 at 4:50 PM, Marcos Dione <mdione at grulic.org.ar> wrote:
> > >> so I'll keep investigating :-]
> > >
> > > maybe context managers add a stack frame/do something with them
> > > internally?
> >
> > Sorry, you're right. Now it seems from looking at the CPython source
> > code that there is no way.
>
> could you point me where in the code? maybe thereś a bug to fix, or
> at least a reason to understand.
here's very good post on the subject:
https://mail.python.org/pipermail/python-dev/2005-January/051018.html
in short: f_locals is a built-on-the-fly dict that actually has the
copy of the original data; it's modifiable, but those modifs don't go
back to where that came from. he also suggests using
PyFrame_LocalsToFast(), and the only two places where that function is
called in in the implementation of from foo import * and some other place
I hadn't figure out yet. and this seems to be like this since before py2.1.
as for the hack itself, it works! \o/ thanks very much for the
pointers :) Cheers,
-- Marcos.
--
(Not so) Random fortune:
<smolski> windows s'enrichis, le libre t'enrichis
More information about the pypy-dev
mailing list