[pypy-dev] Fwd: module SomeObject setattr.

Michael Hudson micahel at gmail.com
Mon Mar 10 01:02:44 CET 2008


This was supposed to go to the list too...

---------- Forwarded message ----------
From: Michael Hudson <micahel at gmail.com>
Date: 10 Mar 2008 13:02
Subject: Re: [pypy-dev] module SomeObject setattr.
To: Toon Verwaest <verwaest at iam.unibe.ch>


On 10/03/2008, Toon Verwaest <verwaest at iam.unibe.ch> wrote:
 > Hi,
 >
 >  I'm not yet fully comfortable with the PyPy code so I just lay it out here:
 >
 >  I have written the following code in the Squeak VM (should change in
 >  the future but its just to show the "problem"):
 >
 >  <file objtable.py:>
 >  objects = []
 >
 >  <file shadow.py:>
 >  objtable.objects += [objofspecifictype]
 >
 >  This seems not to be translatable since this is translated to:
 >  vX = setattr(objtable-module, 'objects', vY).
 >
 >  generally setattr are done on SomeInstance which nicely returns None ->
 >  SomeImpossibleValue -> the annotator is happy.
 >  However, modules appear to be instances of SomeObject


This is, already, your problem: modules are not supported by RPython
 (anything that ends up as SomeObject() means translation is not going
 to work).

 It's a bit peculiar I guess that the module gets examined here, though
 I can see why it happens.  I think if you write
 objtable.objects.extend(...) you'll be happier.


 > on which setattr
 >  returns a SomeObject -> type of vX gets broken.


If anything, this should break even more noisily.


 >  (and the bug received is not very obvious since it says that the
 >  original type was (none)...)


I can believe this part :/

 Cheers,
 mwh



More information about the Pypy-dev mailing list