On Thu, Oct 15, 2015 at 04:47:57PM +0200, Marcos Dione wrote: > On Thu, Oct 15, 2015 at 04:14:02PM +0200, Armin Rigo wrote: > > Hi Marcos, > > > > On Wed, Oct 14, 2015 at 12:58 PM, Marcos Dione <mdi...@grulic.org.ar> wrote: > > > inception_locals= sys._getframe().f_back.f_locals > > > inception_locals.update (locals) > > > > I think this works if you *assign* to f_locals. When you only *read* > > f_locals, you get a copy of the dict. The assignment is needed to > > write the new values back into the frame's real ("optimized") locals: > > > > inception_locals= sys._getframe().f_back.f_locals > > inception_locals.update (locals) > > sys._getframe().f_back.f_locals = inception_locals > > AttributeError: attribute 'f_locals' of 'frame' objects is not writable > > so no cigar here. on the other hand, this works: > > http://mike.verdone.ca/media/Dangerously%20Advanced%20Python.pdf [p21] > > so I'll keep investigating :-]
maybe context managers add a stack frame/do something with them internally? -- (Not so) Random fortune: 02:46 < daemonkeeper> StyXman: Every good system administrator needs to configure sendmail at least once, a real good one won't do it a second time _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev