[pypy-svn] r63134 - in pypy/trunk/pypy/objspace/std: . test

pedronis at codespeak.net pedronis at codespeak.net
Fri Mar 20 13:55:02 CET 2009


Author: pedronis
Date: Fri Mar 20 13:55:00 2009
New Revision: 63134

Modified:
   pypy/trunk/pypy/objspace/std/builtinshortcut.py
   pypy/trunk/pypy/objspace/std/test/test_builtinshortcut.py
Log:
(iko, pedronis)

don't consider conversions for the shortcuts, they may introduce divergences wrt cpython binary op behavior,
fixes unicode string comparison issues with the shortcuts enabled



Modified: pypy/trunk/pypy/objspace/std/builtinshortcut.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/builtinshortcut.py	(original)
+++ pypy/trunk/pypy/objspace/std/builtinshortcut.py	Fri Mar 20 13:55:00 2009
@@ -50,6 +50,14 @@
             % (_name,))
 
 
+def filter_out_conversions(typeorder):
+    res = {}
+    for cls, order in typeorder.iteritems():        
+        res[cls] = [(target_type, converter) for (target_type, converter) in
+                                                 order if converter is None]
+    return res
+
+
 def install(space, mm, fallback_mm=None):
     """Install a function <name>() on the space instance which invokes
     a shortcut for built-in types.  Returns the shortcutting multimethod
@@ -81,7 +89,7 @@
     expanded_order = space.model.get_typeorder_with_empty_usersubcls()
     if fallback_mm:
         mm = mm.merge_with(fallback_mm)
-    shortcut_method = mm.install_not_sliced(expanded_order)
+    shortcut_method = mm.install_not_sliced(filter_out_conversions(expanded_order))
 
     def operate(*args_w):
         try:

Modified: pypy/trunk/pypy/objspace/std/test/test_builtinshortcut.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/test/test_builtinshortcut.py	(original)
+++ pypy/trunk/pypy/objspace/std/test/test_builtinshortcut.py	Fri Mar 20 13:55:00 2009
@@ -62,7 +62,6 @@
         assert 5 + 6.5 == 11.5
 
     def test_unicode_string_compares(self):
-        skip("FAILING")
         assert u'a' == 'a'
         assert 'a' == u'a'
         assert not u'a' == 'b'



More information about the Pypy-commit mailing list