[Python-checkins] python/nondist/sandbox/pickletools pickletools.py,1.33,1.34

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2003年1月27日 08:33:56 -0800


Update of /cvsroot/python/python/nondist/sandbox/pickletools
In directory sc8-pr-cvs1:/tmp/cvs-serv30526
Modified Files:
	pickletools.py 
Log Message:
Explained the surprising dump of the text-mode pickle of the recursive
tuple.
Index: pickletools.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/pickletools/pickletools.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** pickletools.py	27 Jan 2003 16:25:22 -0000	1.33
--- pickletools.py	27 Jan 2003 16:33:51 -0000	1.34
***************
*** 1707,1710 ****
--- 1707,1711 ----
 
 Try "the canonical" recursive-object test.
+ 
 >>> L = []
 >>> T = L,
***************
*** 1737,1740 ****
--- 1738,1749 ----
 9: a APPEND
 10: . STOP
+ 
+ The protocol 0 pickle of the tuple causes the disassembly to get confused,
+ as it doesn't realize that the POP opcode at 16 gets rid of the MARK at 0
+ (so the output remains indented until the end). The protocol 1 pickle
+ doesn't trigger this glitch, because the disassembler realizes that
+ POP_MARK gets rid of the MARK. Doing a better job on the protocol 0
+ pickle would require the disassembler to emulate the stack.
+ 
 >>> dis(pickle.dumps(T))
 0: ( MARK

AltStyle によって変換されたページ (->オリジナル) /