From: <pj...@us...> - 2010-03-13 03:38:47
|
Revision: 6983 http://jython.svn.sourceforge.net/jython/?rev=6983&view=rev Author: pjenvey Date: 2010-03-13 03:38:40 +0000 (Sat, 13 Mar 2010) Log Message: ----------- fix defaultdict __reduce__ not returning an actual iterator for dictitems Modified Paths: -------------- trunk/jython/NEWS trunk/jython/src/org/python/modules/_collections/PyDefaultDict.java Added Paths: ----------- trunk/jython/Lib/test/test_defaultdict_jy.py Added: trunk/jython/Lib/test/test_defaultdict_jy.py =================================================================== --- trunk/jython/Lib/test/test_defaultdict_jy.py (rev 0) +++ trunk/jython/Lib/test/test_defaultdict_jy.py 2010-03-13 03:38:40 UTC (rev 6983) @@ -0,0 +1,23 @@ +"""Misc defaultdict tests. + +Made for Jython. +""" +import pickle +import unittest +from collections import defaultdict +from test import test_support + +class PickleTestCase(unittest.TestCase): + + def test_pickle(self): + d = defaultdict(str, a='foo', b='bar') + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + self.assertEqual(pickle.loads(pickle.dumps(d, proto)), d) + + +def test_main(): + test_support.run_unittest(PickleTestCase) + + +if __name__ == '__main__': + test_main() Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2010-02-25 03:53:18 UTC (rev 6982) +++ trunk/jython/NEWS 2010-03-13 03:38:40 UTC (rev 6983) @@ -19,6 +19,7 @@ - [ 1548 ] Parentheses in CLASSPATH cause errors in jython.bat - Fix runtime issues during exitfuncs triggered via SystemRestart (such as during Django or Pylons development mode reloading) + - Fix pickling of collections.defaultdict objects Jython 2.5.1rc3 Bugs Fixed Modified: trunk/jython/src/org/python/modules/_collections/PyDefaultDict.java =================================================================== --- trunk/jython/src/org/python/modules/_collections/PyDefaultDict.java 2010-02-25 03:53:18 UTC (rev 6982) +++ trunk/jython/src/org/python/modules/_collections/PyDefaultDict.java 2010-03-13 03:38:40 UTC (rev 6983) @@ -100,7 +100,7 @@ PyObject[] ob = {defaultFactory}; args = new PyTuple(ob); } - return new PyTuple(getType(), args, Py.None, Py.None, items()); + return new PyTuple(getType(), args, Py.None, Py.None, iteritems()); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |