From: SourceForge.net <no...@so...> - 2006-09-20 13:43:20
|
Bugs item #1561793, was opened at 2006-09-19 17:50 Message generated for change (Settings changed) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1561793&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core >Group: targeted for 2.2beta1 Status: Open Resolution: None Priority: 5 Submitted By: D Morley (rabidechidna) Assigned to: Nobody/Anonymous (nobody) Summary: Jython 2.2 cannot pickle types again (with patch) Initial Comment: I notice that [1530257] "Jython 2.2 cannot pickle types" has been closed with the comment "This is fixed in trunk", however when I compile the SVN head (revision 2942) I still get errors: Test file: picklebug.py ================ import cPickle import traceback class SimpleObj(object): pass def ptest(x): try: print "PICKLING", x cPickle.dumps(x) except: traceback.print_exc() result = None ptest(int) ptest(SimpleObj()) ptest(SimpleObj) ================ When I run this test, it seems that cPickle is mistakenly attempting to call the __reduce__ method on the class object: ~% ~/jython/jythonHead picklebug.py PICKLING <type 'int'> Traceback (most recent call last): File "picklebug.py", line 10, in ptest cPickle.dumps(x) TypeError: descriptor '__reduce__' of 'int' object needs an argument PICKLING <__main__.SimpleObj object 1> Traceback (most recent call last): File "picklebug.py", line 10, in ptest cPickle.dumps(x) TypeError: descriptor '__reduce__' of 'object' object needs an argument PICKLING <class '__main__.SimpleObj'> Traceback (most recent call last): File "picklebug.py", line 10, in ptest cPickle.dumps(x) TypeError: descriptor '__reduce__' of 'object' object needs an argument The attached patch fixes the problem. ---------------------------------------------------------------------- Comment By: Charles Groves (cgroves) Date: 2006-09-20 08:42 Message: Logged In: YES user_id=1174327 I closed 1530257 because it had more to do with pickling in general being broken. Your tests pass if you import pickle instead of cPickle. I figured leaving 1291509 open to indicate the cPickle brokenness was enough. That said, your patch fixes 15 out of the 37 broken tests in cPickle. I'll apply it whenever I get a chance to see what's causing the remaining 15 to fail. If you want to run test_cPickle.py in Lib/test yourself and take out the remaining 15 with an updated patch(or explain why they can't be fixed), I'll apply it immediately(and be forever grateful). It'll probably be another week or two until I get to look at cPickle. Leave a comment here if you're working on this, and I'll check in with you when I'm ready to start. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1561793&group_id=12867 |