Commits

Philip Jenvey committed 7065efc

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

Comments (0)

Files changed (2)

pypy/objspace/std/listobject.py

     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
 
         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

pypy/objspace/std/test/test_listobject.py

         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}