Author: Vasily Kuznetsov <[email protected]>
Branch: py3.3
Changeset: r72517:88e3c7e587b4
Date: 2014-07-26 16:05 +0200
http://bitbucket.org/pypy/pypy/changeset/88e3c7e587b4/
Log: Added a test for the situation when one of the iterators given to
map has been already advanced (suggested by Armin Rigo).
diff --git a/pypy/module/__builtin__/test/test_map_pickle.py
b/pypy/module/__builtin__/test/test_map_pickle.py
--- a/pypy/module/__builtin__/test/test_map_pickle.py
+++ b/pypy/module/__builtin__/test/test_map_pickle.py
@@ -26,3 +26,19 @@
assert list(m1) == list(m1_)
+ def test_map2_adv_pickle(self):
+ """If some iterator was advanced, the pickling preserves it."""
+ import pickle
+
+ def pickle_unpickle(obj):
+ d = pickle.dumps(obj)
+ return pickle.loads(d)
+
+ s1 = iter("abc")
+ s2 = iter("defg")
+ next(s2)
+
+ m1 = map(max, s1, s2)
+ m1_ = pickle_unpickle(m1)
+
+ assert list(m1) == list(m1_)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit