Commits

Maciej Fijalkowski committed ed68558

iterator fixes, some tests, oops

  • Participants
  • Parent commits d976477
  • Branches speedup-unpackiterable

Comments (0)

Files changed (3)

File pypy/objspace/std/kwargsdict.py

         return keys[:], values_w[:] # copy to make non-resizable
 
     def getiterkeys(self, w_dict):
-        return self.unerase(w_dict.dstorage)[0]
+        return iter(self.unerase(w_dict.dstorage)[0])
     def getitervalues(self, w_dict):
-        return self.unerase(w_dict.dstorage)[1]
+        return iter(self.unerase(w_dict.dstorage)[1])
     def getiteritems(self, w_dict):
         keys = self.unerase(w_dict.dstorage)[0]
         return iter(range(len(keys)))

File pypy/objspace/std/test/test_dictmultiobject.py

         class E(dict):
             pass
         assert isinstance(D.fromkeys([1, 2]), E)
+        assert dict.fromkeys({"a": 2, "b": 3}) == {"a": None, "b": None}
+        assert dict.fromkeys({"a": 2, 1: 3}) == {"a": None, 1: None}
 
     def test_str_uses_repr(self):
         class D(dict):

File pypy/objspace/std/test/test_kwargsdict.py

         d = f()
         assert "EmptyKwargsDictStrategy" in self.get_strategy(d)
 
+    def test_iterator(self):
+        def f(**args):
+            return args
+
+        assert dict.fromkeys(f(a=2, b=3)) == {"a": None, "b": None}
+        assert sorted(f(a=2, b=3).itervalues()) == [2, 3]