[pypy-svn] rev 586 - in pypy/trunk/src/pypy: interpreter/test objspace

alex at codespeak.net alex at codespeak.net
Tue May 27 17:21:57 CEST 2003


Author: alex
Date: Tue May 27 17:21:56 2003
New Revision: 586

Modified:
   pypy/trunk/src/pypy/interpreter/test/test_interpreter.py
   pypy/trunk/src/pypy/objspace/trivial.py
Log:
trying to make more tests pass w/trivial objspace



Modified: pypy/trunk/src/pypy/interpreter/test/test_interpreter.py
==============================================================================
--- pypy/trunk/src/pypy/interpreter/test/test_interpreter.py	(original)
+++ pypy/trunk/src/pypy/interpreter/test/test_interpreter.py	Tue May 27 17:21:56 2003
@@ -56,12 +56,12 @@
 def g(): print 10''', 'g', [])
         self.assertEquals(x, None)
 
-    def aatest_identity(self):
+    def test_identity(self):
         x = self.codetest('''
 def g(x): return x''', 'g', [666])
         self.assertEquals(x, 666)
 
-    def aatest_exception(self):
+    def test_exception(self):
         x = self.codetest('''
 def f():
     try:

Modified: pypy/trunk/src/pypy/objspace/trivial.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/trivial.py	(original)
+++ pypy/trunk/src/pypy/objspace/trivial.py	Tue May 27 17:21:56 2003
@@ -12,16 +12,24 @@
 class TrivialObjSpace(ObjSpace):
 
     def initialize(self):
-        import __builtin__, types
-        self.w_builtins.update(__builtin__.__dict__)
-        for n, c in self.w_builtins.iteritems():
-            if isinstance(c, types.ClassType) and issubclass(c, Exception):
-                setattr(self, 'w_' + c.__name__, c)
         self.w_None = None
         self.w_True = True
         self.w_False = False
+        import __builtin__, types
+        newstuff = {"False": self.w_False,
+                    "True" : self.w_True,
+                    "None" : self.w_None,
+                    }
+        for n, c in __builtin__.__dict__.iteritems():
+            if isinstance(c, types.ClassType) and issubclass(c, Exception):
+                w_c = c
+                setattr(self, 'w_' + c.__name__, w_c)
+                newstuff[c.__name__] = w_c
         self.make_builtins()
         self.make_sys()
+        # insert these into the newly-made builtins
+        for key, w_value in newstuff.items():
+            self.setitem(self.w_builtins, self.wrap(key), w_value)
 
     # general stuff
     def wrap(self, x):


More information about the Pypy-commit mailing list