[pypy-dev] Annotating space status
Samuele Pedroni
pedronis at bluewin.ch
Sat Jul 5 03:36:41 MEST 2003
At 19:31 04.07.2003 -0400, Guido van Rossum wrote:
> > >I have a feeling that the real problem here may be that the value
> > >stack isn't properly cloned, which means that the frames stored in
> > >knownframes will share their objects with the frame being modified as
> > >part of the current frame evaluation. I'd bet that if you properly
> > >clone the value stack using clonecells(), Samuele's hack (adding a
> > >'changed' flag to the W_ConstantIterator class) would no longer be
> > >necessary.
> > >
> > >Wishing I had time to code this up,
> >
> > makes sense, done.
>
>Thanks, cool.
r = self.codetest("def f(a):\n"
" x = [1,2]\n"
" if a:\n"
" x.append(3)\n"
" else:\n"
" x.append(3)\n"
" return x",
'f',[W_Anything()])
print r
this prints W_Constant([1, 2, 3, 3])
the first obvious fix works up to:
r = self.codetest("def f(a):\n"
" x = [1,2]\n"
" y = x\n"
" if a:\n"
" x.append(3)\n"
" else:\n"
" x.append(3)\n"
" return y",
'f',[W_Anything()])
if we care about this, it seems that state cloning should be done on the
state as a whole caring for identity like pickling or deepcopy do.
More information about the pypy-dev
mailing list