[Python-checkins] python/nondist/sandbox/pickletools pickletools.py,1.22,1.23
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Sun, 26 Jan 2003 10:34:31 -0800
Update of /cvsroot/python/python/nondist/sandbox/pickletools
In directory sc8-pr-cvs1:/tmp/cvs-serv6934
Modified Files:
pickletools.py
Log Message:
Added PERSID and BINPERSID.
Index: pickletools.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/pickletools/pickletools.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** pickletools.py 26 Jan 2003 18:17:06 -0000 1.22
--- pickletools.py 26 Jan 2003 18:34:29 -0000 1.23
***************
*** 272,275 ****
--- 272,288 ----
""")
+ def read_stringnl_noescape(f):
+ return read_stringnl(f, decode=False, stripquotes=False)
+
+ stringnl_noescape = ArgumentDescriptor(
+ name='stringnl_noescape',
+ n=UP_TO_NEWLINE,
+ reader=read_stringnl_noescape,
+ doc="""A newline-terminated string.
+
+ This is a str-style string, without embedded escapes,
+ or bracketing quotes. It should consist solely of
+ printable ASCII characters.
+ """)
def read_string4(f):
***************
*** 1190,1204 ****
"""),
! # XXX opcodes below this point haven't been done yet.
I(name='PERSID',
code='P',
! arg=None,
stack_before=[],
! stack_after=[],
proto=0,
! doc="""XXX One-line description goes here.
! XXX Doc body goes here.
"""),
--- 1203,1223 ----
"""),
! # Ways to deal with persistent IDs.
I(name='PERSID',
code='P',
! arg=stringnl_noescape,
stack_before=[],
! stack_after=[anyobject],
proto=0,
! doc="""Push an object identified by a persisent ID.
! The pickle module doesn't define what a persisent ID means. PERSID's
! argument is a newline-terminated str-style (no embedded escapes, no
! bracketing quote characters) string, which *is* "the persistent ID".
! The unpickler passes this string to self.persistent_load(). Whatever
! object that returns is pushed on the stack. There is no implementation
! of persistent_load() in Python's unpickler: it must be supplied by an
! unpickler subclass.
"""),
***************
*** 1206,1216 ****
code='Q',
arg=None,
! stack_before=[],
! stack_after=[],
! proto=0,
! doc="""XXX One-line description goes here.
! XXX Doc body goes here.
"""),
I(name='REDUCE',
--- 1225,1240 ----
code='Q',
arg=None,
! stack_before=[anyobject],
! stack_after=[anyobject],
! proto=1,
! doc="""Push an object identified by a persistent ID.
! Like PERSID, except the persistent ID is popped off the stack (instead
! of being a string embedded in the opcode bytestream). The persistent
! ID is passed to self.persistent_load(), and whatever object that
! returns is pushed on the stack. See PERSID for more detail.
"""),
+
+ # XXX opcodes below this point haven't been done yet.
I(name='REDUCE',