[pypy-svn] r30080 - in pypy/dist/pypy: rpython/test translator/cli translator/cli/test

antocuni at codespeak.net antocuni at codespeak.net
Sun Jul 16 17:39:00 CEST 2006


Author: antocuni
Date: Sun Jul 16 17:38:51 2006
New Revision: 30080

Modified:
   pypy/dist/pypy/rpython/test/test_objectmodel.py
   pypy/dist/pypy/translator/cli/comparer.py
   pypy/dist/pypy/translator/cli/database.py
   pypy/dist/pypy/translator/cli/test/test_objectmodel.py
Log:
Added support for r_dict whose functions are method of a frozen
pbc. The test_rtype_r_dict_singlefrozen_func has been split in two
parts because gencli can handle only one of those, at the moment.



Modified: pypy/dist/pypy/rpython/test/test_objectmodel.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_objectmodel.py	(original)
+++ pypy/dist/pypy/rpython/test/test_objectmodel.py	Sun Jul 16 17:38:51 2006
@@ -180,10 +180,19 @@
             def _freeze_(self):
                 return True
         obj = FreezingClass()
-        pbc_d = r_dict(obj.key_eq, obj.key_hash)        
         def fn():
             d = r_dict(obj.key_eq, obj.key_hash)
-            return play_with_r_dict(d) and play_with_r_dict(pbc_d)
+            return play_with_r_dict(d)
+        assert self.interpret(fn, []) is True
+
+    def test_rtype_r_dict_singlefrozen_func_pbc(self):
+        class FreezingClass(Strange):
+            def _freeze_(self):
+                return True
+        obj = FreezingClass()
+        pbc_d = r_dict(obj.key_eq, obj.key_hash)        
+        def fn():
+            return play_with_r_dict(pbc_d)
         assert self.interpret(fn, []) is True
 
     def test_rtype_r_dict_exceptions(self):

Modified: pypy/dist/pypy/translator/cli/comparer.py
==============================================================================
--- pypy/dist/pypy/translator/cli/comparer.py	(original)
+++ pypy/dist/pypy/translator/cli/comparer.py	Sun Jul 16 17:38:51 2006
@@ -43,16 +43,13 @@
 
         fn, obj, method_name = fn_args
         if method_name.value is None:
-            if obj.value is None:
-                self._call_function(fn, len(arglist), [])
-            else:
-                assert False, 'XXX'
+            self._call_function(fn, len(arglist))
         else:
             assert False, 'XXX'
 
         self.ilasm.end_function()
 
-    def _call_function(self, fn, n_args, additional_args):
+    def _call_function(self, fn, n_args):
         # fn is a HalfConcreteWrapper
         sm = fn.value.concretize().value
         self.db.pending_function(sm.graph)

Modified: pypy/dist/pypy/translator/cli/database.py
==============================================================================
--- pypy/dist/pypy/translator/cli/database.py	(original)
+++ pypy/dist/pypy/translator/cli/database.py	Sun Jul 16 17:38:51 2006
@@ -154,6 +154,8 @@
             return StaticMethodConst(db, value, count)
         elif isinstance(value, ootype._class):
             return ClassConst(db, value, count)
+        elif isinstance(value, ootype._custom_dict):
+            assert False, 'Unknown constant: %s' % value
         elif isinstance(value, ootype._dict):
             return DictConst(db, value, count)
         else:

Modified: pypy/dist/pypy/translator/cli/test/test_objectmodel.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_objectmodel.py	(original)
+++ pypy/dist/pypy/translator/cli/test/test_objectmodel.py	Sun Jul 16 17:38:51 2006
@@ -8,8 +8,7 @@
 class TestCliObjectModel(CliTest, BaseTestObjectModel):
     test_rtype_r_dict_bm = skip_r_dict
     test_rtype_constant_r_dicts = skip_r_dict
-    test_rtype_r_dict_singlefrozen_func = skip_r_dict
+    test_rtype_r_dict_singlefrozen_func_pbc = skip_r_dict
 
     def test_hint(self):
         py.test.skip('Hint is not supported, yet')
-    



More information about the Pypy-commit mailing list