[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-dev
Subject:    Re: [pypy-dev] [mdione@grulic.org.ar: modifying locals]
From:       Marcos Dione <mdione () grulic ! org ! ar>
Date:       2015-10-16 18:16:24
Message-ID: 20151016181624.GE32186 () diablo ! grulicueva ! local
[Download RAW message or body]

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@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
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic