[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-09 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Closing the issue as it's really a quirk rather than a bug. Thanks for reporting, though. -- resolution: -> wont fix stage: -> committed/rejected status: open -> closed ___ Python tracker

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Kay Hayen
Kay Hayen added the comment: I see, if it's refcount dependent, that explains why it changes from interpreter provided dictionary and self-created one. So, I take, I should always call "pickletools.optimize( cPickle.dumps( value ))" then. Thanks, Kay --

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Regarding the "marshal", I presume, that somehow the dictionary when > created via "marshal" (or compile, if no ".pyc" is involved?) first > time is somehow less efficient to determine/stream that the one > "cPickle" created. I don't think so. marshal uses a

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: I think the "premature" optimization comes down to that code: """ static int put(Picklerobject *self, PyObject *ob) { if (Py_REFCNT(ob) < 2 || self->fast) return 0; return put2(self, ob); } """ (put2() being the function which emits BINPUT) W

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Kay Hayen
Kay Hayen added the comment: Sending my attached file "stream.py" through "2to3.py" it shows that CPython 3.2 doesn't exihibit the issue for either protocol, which may be because it's now "unicode" key, but as it's the only value I tried, I can't tell. Hope this helps. Regarding the "marshal

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, right. BINPUT is used to memoize objects in case a restructive structure happens. You can use pickletools.optimize() to remove the useless BINPUTs out of a pickle stream. Note that 3.x is more consistent and always emits the BINPUTs. It seems 2.x's cPick

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Kay Hayen
Kay Hayen added the comment: It seems that there is an extra "BINPUT 2", whatever it does. I am attaching a variant that does pickletools.dis on the 3 dumps. Protocol 2 : Dumping read const const stream '\x80\x02}q\x01U\x07modulesq\x02Ns.' 0: \x80 PROTO 2 2: }EMPTY_DICT 3:

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: - Can you use pickletools.dis to examine what differs in the pickles' bytecode? - Does it also apply to 3.3? > It appears at least some kind of efficiency might be missed out for > marshall as well. marshal doesn't use the pickle protocols, so it's unlikely to

[issue13735] The protocol > 0 of cPickle does not given stable dictionary values

2012-01-07 Thread Kay Hayen
New submission from Kay Hayen : Hello, I am implementing a Python compiler (Nuitka) that is testing if when it compiles itself, it gives the same output. I have been using "protocol = 0" ever since with "pickle" module for historic reasons (gcc bug with raw strings lead me to believe it's be