Author: Philip Jenvey <[email protected]>
Branch: 
Changeset: r65008:7065efc00da6
Date: 2013-06-26 12:11 -0700
http://bitbucket.org/pypy/pypy/changeset/7065efc00da6/

Log:    (fijal) revert a052f153e311 for now: python-dev's waffled on nan
        containment quite a bit but there's no strong consensus on it

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -1222,7 +1222,8 @@
     def _safe_find(self, w_list, obj, start, stop):
         l = self.unerase(w_list.lstorage)
         for i in range(start, min(stop, len(l))):
-            if l[i] == obj:
+            val = l[i]
+            if val == obj:
                 return i
         raise ValueError
 
@@ -1542,18 +1543,6 @@
         if reverse:
             l.reverse()
 
-    def _safe_find(self, w_list, obj, start, stop):
-        from rpython.rlib.rfloat import isnan
-        if not isnan(obj):
-            return AbstractUnwrappedStrategy._safe_find(self, w_list, obj,
-                                                        start, stop)
-        # unwrapped nan != nan, finding it requires more effort
-        l = self.unerase(w_list.lstorage)
-        for i in range(start, min(stop, len(l))):
-            if isnan(l[i]):
-                return i
-        raise ValueError
-
 
 class StringListStrategy(AbstractUnwrappedStrategy, ListStrategy):
     _none_value = None
diff --git a/pypy/objspace/std/test/test_listobject.py 
b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -1314,10 +1314,6 @@
         non_list = NonList()
         assert [] != non_list
 
-    def test_nan_containment(self):
-        nan = float('nan')
-        assert nan in [nan]
-
 
 class AppTestForRangeLists(AppTestW_ListObject):
     spaceconfig = {"objspace.std.withrangelist": True}
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to