[pypy-svn] r65138 - in pypy/branch/io-lang/pypy/lang/io: . test
david at codespeak.net
david at codespeak.net
Thu May 7 16:04:40 CEST 2009
Author: david
Date: Thu May 7 16:04:40 2009
New Revision: 65138
Modified:
pypy/branch/io-lang/pypy/lang/io/objspace.py
pypy/branch/io-lang/pypy/lang/io/test/test_model.py
Log:
(cfbolz, david) made the object model more like the real io object model (e.g. cyclic)
Modified: pypy/branch/io-lang/pypy/lang/io/objspace.py
==============================================================================
--- pypy/branch/io-lang/pypy/lang/io/objspace.py (original)
+++ pypy/branch/io-lang/pypy/lang/io/objspace.py Thu May 7 16:04:40 2009
@@ -10,7 +10,8 @@
class ObjSpace(object):
"""docstring for ObjSpace"""
def __init__(self):
- self.init_w_object()
+ self.w_object = W_Object(self)
+
self.w_lobby = W_Object(self)
self.w_protos = W_Object(self)
self.w_core = W_Object(self)
@@ -21,11 +22,9 @@
self.w_block = W_Block(self, [], W_Message(self, 'nil', []), False, [self.w_object])
self.w_list = W_List(self, [self.w_object])
+ self.init_w_object()
- self.w_core.protos.append(self.w_object)
-
- self.w_protos.protos.append(self.w_core)
- self.w_protos.slots['Core'] = self.w_core
+ self.init_w_protos()
self.init_w_list()
@@ -37,6 +36,11 @@
self.init_w_core()
+
+ def init_w_protos(self):
+ self.w_protos.protos.append(self.w_core)
+ self.w_protos.slots['Core'] = self.w_core
+
def init_w_block(self):
for key, function in cfunction_definitions['Block'].items():
self.w_block.slots[key] = W_CFunction(self, function)
@@ -46,6 +50,7 @@
self.w_list.slots[key] = W_CFunction(self, function)
def init_w_core(self):
+ self.w_core.protos.append(self.w_object)
self.w_core.slots['Locals'] = self.w_locals
self.w_core.slots['Block'] = self.w_block
self.w_core.slots['Object'] = self.w_object
@@ -64,10 +69,12 @@
def init_w_lobby(self):
self.w_lobby.protos.append(self.w_protos)
+ self.w_object.protos.append(self.w_lobby)
self.w_lobby.slots['Lobby'] = self.w_lobby
self.w_lobby.slots['Protos'] = self.w_protos
def init_w_object(self):
- self.w_object = W_Object(self)
+
+
for key, function in cfunction_definitions['Object'].items():
self.w_object.slots[key] = W_CFunction(self, function)
\ No newline at end of file
Modified: pypy/branch/io-lang/pypy/lang/io/test/test_model.py
==============================================================================
--- pypy/branch/io-lang/pypy/lang/io/test/test_model.py (original)
+++ pypy/branch/io-lang/pypy/lang/io/test/test_model.py Thu May 7 16:04:40 2009
@@ -61,4 +61,8 @@
assert a.lookup('fail') is None
assert a.lookup('a').value == 1
assert a.lookup('b').value == 2
- assert a.lookup('c').value == 3
\ No newline at end of file
+ assert a.lookup('c').value == 3
+
+def test_lookup_cycle_builtins():
+ space = ObjSpace()
+ assert space.w_object.lookup('Lobby') is space.w_lobby
\ No newline at end of file
More information about the Pypy-commit
mailing list