Oops, forgot to cc pypy-dev...

Carl Friedrich


-------- Original Message --------
From: Carl Friedrich Bolz <cfb...@gmx.de>
Sent: December 19, 2016 5:59:01 PM GMT+01:00
To: Frank Wang <fra...@mit.edu>
Subject: Re: [pypy-dev] Adding init/variables to W_Root

Hi Frank, 

The solution is to add an _attrs_ = ('__weakref__', 'rb_flags',) declaration to 
the body of W_Root. It's like  __slots__, but only for RPython. 

Cheers, 
Carl Friedrich

On December 19, 2016 5:42:12 PM GMT+01:00, Frank Wang <fra...@mit.edu> wrote:
>Hi Armin,
>
>If I modify the line to __slots__ = ('__weakref__', 'rb_flags',), I get
>the
>following error:
>
>[translation:ERROR] AssertionError:
><pypy.interpreter.generator.GeneratorIterator object at
>0x00000000073e87c8>: to run register_finalizer() untranslated, the
>object
>must not have __slots__
>
>If I remove that line completely, I get the following error,
>
>[translation:ERROR] Exception: <class
>'pypy.objspace.std.dictmultiobject.W_DictMultiObject'> has slots or
>_attrs_, but not its base class
>Processing block:
> block@3 is a <class 'rpython.flowspace.flowcontext.SpamBlock'>
> in (pypy.interpreter.mixedmodule:83)MixedModule.getdictvalue
> containing the following operations:
>       v0 = getattr(space_0, ('finditem_str'))
>       v1 = getattr(self_0, ('w_dict'))
>       w_value_0 = simple_call(v0, v1, name_0)
>       v2 = getattr(self_0, ('lazy'))
>       v3 = bool(v2)
> --end--
>
>I wonder what error in your opinion is easier to get around.
>
>Thanks for the help!
>
>Frank
>
>On Mon, Dec 19, 2016 at 2:26 AM, Armin Rigo <armin.r...@gmail.com>
>wrote:
>
>> Hi Frank,
>>
>> On 19 December 2016 at 05:29, Frank Wang <fra...@mit.edu> wrote:
>> > Attribute 'rb_flags' on <ClassDef 'pypy.interpreter.
>> baseobjspace.W_Root'>
>> > should be read-only.
>>
>> Ah, did you adapt or remove this line in class W_Root?
>>
>>     __slots__ = ('__weakref__',)
>>
>> The annotator complains, I think, because 'rb_flags' is forbidden by
>> this line (which is useful to avoid having random attributes
>> accidentally move up to W_Root).
>>
>>
>> A bientôt,
>>
>> Armin.
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>pypy-dev mailing list
>pypy-dev@python.org
>https://mail.python.org/mailman/listinfo/pypy-dev
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to