[pypy-dev] Adding init/variables to W_Root

Frank Wang frankw at mit.edu
Mon Dec 19 11:42:12 EST 2016


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 at 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.rigo at gmail.com> wrote:

> Hi Frank,
>
> On 19 December 2016 at 05:29, Frank Wang <frankw at 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20161219/c89dea20/attachment.html>


More information about the pypy-dev mailing list