[pypy-dev] module SomeObject setattr.

Armin Rigo arigo at tunes.org
Mon Mar 10 22:34:39 CET 2008

Hi Toon,

On Mon, Mar 10, 2008 at 12:53:26AM +0100, Toon Verwaest wrote:
> <file objtable.py:>
> objects = []
> <file shadow.py:>
> objtable.objects += [objofspecifictype]

You cannot mutate global lists in RPython code.  (It's fine to do it
outside the RPython-compiled function, of course.)  If you need global
state it should be put on a prebuilt global instance of a class that you

Note btw that the Smalltalk interpreter in PyPy should probably be
modified to have a 'space' object passed around; the 'space' would play
precisely the role of the global state.  That's far cleaner than what we
came up with during the Bern sprint, which is to patch module-global
objects from various places.  For example, all the globals in
objspace.py should go on such a 'space', and the 'space' would be
populated either by the image loader or manually for smaller tests.

A bientot,


More information about the Pypy-dev mailing list