[pypy-svn] pypy default: Updated pickling of dictiters to match CPython.

tav commits-noreply at bitbucket.org
Thu Mar 3 13:21:53 CET 2011


Author: tav <tav at espians.com>
Branch: 
Changeset: r42407:1b3dcfdd2203
Date: 2011-03-03 12:21 +0000
http://bitbucket.org/pypy/pypy/changeset/1b3dcfdd2203/

Log:	Updated pickling of dictiters to match CPython.

diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py
--- a/pypy/interpreter/test/test_zzpickle_and_slow.py
+++ b/pypy/interpreter/test/test_zzpickle_and_slow.py
@@ -359,16 +359,14 @@
         raises(TypeError, len, liter)
         assert list(liter) == list(result)
 
-    @py.test.mark.xfail
+    # This test used to be marked xfail and it tried to test for the past
+    # support of pickling dictiter objects.
     def test_pickle_dictiter(self):
         import pickle
         tdict = {'2':2, '3':3, '5':5}
         diter  = iter(tdict)
         diter.next()
-        pckl   = pickle.dumps(diter)
-        result = pickle.loads(pckl)
-        raises(TypeError, len, diter)
-        assert list(diter) == list(result)
+        raises(TypeError, pickle.dumps, diter)
 
     def test_pickle_reversed(self):
         import pickle

diff --git a/pypy/objspace/std/dicttype.py b/pypy/objspace/std/dicttype.py
--- a/pypy/objspace/std/dicttype.py
+++ b/pypy/objspace/std/dicttype.py
@@ -154,8 +154,8 @@
     w_typeobj = space.gettypeobject(dictiter_typedef)
 
     raise OperationError(
-        space.w_RuntimeError,
-        space.wrap("cannot pickle dictiters with multidicts"))
+        space.w_TypeError,
+        space.wrap("can't pickle dictionary-keyiterator objects"))
     # XXXXXX get that working again
 
     # we cannot call __init__ since we don't have the original dict


More information about the Pypy-commit mailing list