[pypy-svn] r5380 - in pypy/trunk/src/pypy/objspace: flow/test std

arigo at codespeak.net arigo at codespeak.net
Mon Jun 28 14:46:19 CEST 2004


Author: arigo
Date: Mon Jun 28 14:46:18 2004
New Revision: 5380

Modified:
   pypy/trunk/src/pypy/objspace/flow/test/test_objspace.py
   pypy/trunk/src/pypy/objspace/std/dictobject.py
Log:
translate_pypy progress.
* a test for using global constant data
* removed checks in dictobject.py that confused FlowObjSpace

We should figure out a way for the FlowObjSpace to optionally ignore the 
'assert' statements.  It's not obvious unless the whole process is run in -O
but then we loose the interesting asserts in FlowObjSpace and annotation
themselves...


Modified: pypy/trunk/src/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/test/test_objspace.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/test/test_objspace.py	Mon Jun 28 14:46:18 2004
@@ -257,6 +257,18 @@
         x = self.codetest(self.dellocal)
         self.show(x)
 
+    #__________________________________________________________
+    def globalconstdict(name):
+        x = DATA['x']
+        z = DATA[name]
+        return x, z
+    
+    def test_globalconstdict(self):
+        x = self.codetest(self.globalconstdict)
+        self.show(x)
+
+DATA = {'x': 5,
+        'y': 6}
 
 if __name__ == '__main__':
     testit.main()

Modified: pypy/trunk/src/pypy/objspace/std/dictobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/dictobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/dictobject.py	Mon Jun 28 14:46:18 2004
@@ -73,16 +73,13 @@
             freeslot = None
 
         perturb = lookup_hash
-        if __debug__:
-            c = len(self.data) + 99
+        ##c = len(self.data) + 99
         while 1:
-            if __debug__:
-                c -= 1
-                if not c:
-                    import sys, pdb
-                    print >> sys.stderr, 'dict lookup lost in infinite loop'
-                    pdb.set_trace()
-                
+            ##c -= 1
+            ##if not c:
+            ##    import sys, pdb
+            ##    print >> sys.stderr, 'dict lookup lost in infinite loop'
+            ##    pdb.set_trace()
             i = (i << 2) + i + perturb + 1
             entry = self.data[i%len(self.data)]
             if entry[1] is None:



More information about the Pypy-commit mailing list