[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-07-17 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Committed issue5180b.diff with minor additions in r82937 (r82938 for 3.1): 1. Added an assert that args is a tuple in instantiate() with an explanation why it is true. 2. Added a test for the other code branch instantiate. (Not all conditions are tes

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-07-17 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: The args argument is always a tuple created with Pdata_poptuple(). You can add an explicit type check. If this check fails a RuntimeError should be raised, because this would indicate a programming error in pickle. -- __

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-07-17 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Alexandre, I am not sure your change form PyObject_Size(args) to Py_SIZE(args) is correct. As far as I can tell, args come from pickle machine stack without any type checks. The equivalent code in 2.x cPickle uses PyObject_Size and checks for errors.

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-07-17 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: I have fixed some style nits in your patch. It would be nice to have tests for the different control paths in instantiate(). But, I realize that would be a bit annoying. Apart from that, the patch looks good. -- Added file: http://bugs.python.o

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-07-16 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Antoine said on IRC that he is ok with the latest approach. Does anyone want to review the patch before it goes in? -- resolution: -> accepted stage: patch review -> commit review ___ Python tracker

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-07-15 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Antoine, I think I have found a better solution. Since we are dealing with classic classes, they should not define __new__. If in porting to 3.x, users introduce __new__ that requires arguments, they will not be able to unpickle 2.x pickles no matter

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Well, this is not so obviously wrong as you make it sound. If you > look closer at object_new(), you will see that in sane situations it > reduces to type->tp_alloc(type, 0) call. Today, yes. But tomorrow it may entail additional operations. > If such sanit

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Mon, Jun 28, 2010 at 7:32 PM, Antoine Pitrou wrote: >> My patch attempts to emulate 2.x PyInstance_NewRaw with a call to >> tp_alloc. > > This is certainly the wrong thing to do. You could at least try > PyBaseObject_Type.tp_new (see object_new() in ty

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: (and to follow on my example, I'd point that the unpickled instance is still an instance of the right class: >>> type(x) ) -- ___ Python tracker ___

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: > My patch attempts to emulate 2.x PyInstance_NewRaw with a call to > tp_alloc. This is certainly the wrong thing to do. You could at least try PyBaseObject_Type.tp_new (see object_new() in typeobject.c), but even this is not necessarily right (for example if

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexandre Vassalotti
Alexandre Vassalotti added the comment: Thank you for the nice investigative work! I will try my best to review this patch by next week. -- ___ Python tracker ___ _

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- stage: unit test needed -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file17788/issue5180-fix.diff ___ Python tracker ___ ___ Python-bugs-list

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file17781/issue5180.diff ___ Python tracker ___ ___ Python-bugs-list mai

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a patch which focuses on fixing _pickle behavior. I opened a separate issue9102 to deal with pybench specific problems. Marc-Andre, I am reassigning this issue to myself and assigning issue9102 to you. I hope you don't mind. My patch

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > The bytes/string issu was a red herring: with pickle.load(open('27.bench', > 'b')), I get the same stack trace as from command line pybench invocation. > > pickle.load(ope

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-28 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > I am attaching a patch which makes python3 read 27.bench without errors. I > think this should be applied while a complete solution for unpickling old > style class instances f

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a patch which makes python3 read 27.bench without errors. I think this should be applied while a complete solution for unpickling old style class instances from text mode (protocol = 0) pickles is found. -- Added file: http://bug

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The remaining bug is a bit harder. If you try to run unpickle-bug-2.py on the same pickle, you get $ python3 unpickle-bug-2.py /tmp/bug.pkl <__main__.Bug object at 0x1006a8f40> Traceback (most recent call last): File "unpickle-bug-2.py", line 9, in

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: As promised, here is the fix (issue5180-pickle.diff) for the "unpickle-bug.py" issue. Unfortunately, it looks like more bugs remain. 27.bench is still not loadable. -- stage: -> unit test needed Added file: http://bugs.python.org/file17786/i

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Added file: http://bugs.python.org/file17785/unpickle-bug.py ___ Python tracker ___ ___ Python-bugs-list mail

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: It looks like I was able to get to the root of the problem. I am attaching two files that demonstrate the issue: ==> pickle-bug.py <== import pickle import sys class Bug: pass bug = Bug() f = open(sys.argv[1], 'w') pickle.Pickler(f, protocol=0).dum

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I have found issue1634499 which deals with running pybench. I suggest that we reopen that issue and move discussion of issue5180.diff there. I really like the idea to keep single source for 2.x and 3.x pybench, but we need to add some machinery to run

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Please keep the Python3 version of pybench compatible to Python 2.6 and 2.7. -- ___ Python tracker ___ _

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-27 Thread Georg Brandl
Changes by Georg Brandl : -- assignee: -> lemburg nosy: +lemburg ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Hmm. It looks like another pickle vs. _pickle issue. Attached patch is a result of 2to3 applied to Tools/pybench (and a minor manual fix for pickle import) with _pickle import disabled. With the patch applied, $ ./python Tools/pybench/pybench.py --de

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: The bytes/string issu was a red herring: with pickle.load(open('27.bench', 'b')), I get the same stack trace as from command line pybench invocation. >>> pickle.load(open('27.bench', 'rb')) Traceback (most recent call last): File "", line 1, in Fil

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-06-26 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: If I disable _pickle, I get a more meaningful trace: File "Tools/pybench/pybench.py", line 954, in PyBenchCmdline() File "/Users/sasha/Work/python-svn/py3k-commit/Tools/pybench/CommandLine.py", line 349, in __init__ rc = self.main() File

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2010-05-11 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: +Python 3.2 -Python 3.0 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2009-02-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is the pickle file. Added file: http://bugs.python.org/file12973/27.bench ___ Python tracker ___ ___ Py

[issue5180] 3.1 cannot unpickle 2.7-created pickle

2009-02-07 Thread Antoine Pitrou
New submission from Antoine Pitrou : The pickle was generated by pybench. You can try to display it by running: ./python Tools/pybench/pybench.py --debug -s 27.bench It fails with the following traceback: Traceback (most recent call last): File "Tools/pybench/pybench.py", line 954, in P