Commit Graph

34 Commits

Author SHA1 Message Date
Mark Dickinson 10085c656f Issue #3657: fix occasional test_pickletools failures. 2009-01-24 21:08:38 +00:00
Georg Brandl dffbf5f542 Revert copy_reg -> copyreg rename. 2008-05-20 07:49:57 +00:00
Alexandre Vassalotti ea0b22a167 Patch by Quentin Gallet-Gilles: Renaming leftovers for 2.6.
This fixes the omissions of configparser, copyreg, queue and
socketserver renaming.
2008-05-16 18:03:52 +00:00
Raymond Hettinger da614dcc4f Complete an open todo on pickletools -- add a pickle optimizer. 2008-02-10 20:35:16 +00:00
Tim Peters 90718a4eb5 An instance of class PicklingError was used here simply as an example of
_some_ user-defined class instance.  That it was also an exception isn't
interesting, but does interfere with Michael Hudson's new-style exception
patch.  This just changes the doctest example, to use an instance of a
non-exception class.
2005-02-15 16:22:34 +00:00
Raymond Hettinger 6c1e0fe7ba Remove reference to old pickle feature. 2004-12-07 08:26:10 +00:00
Tim Peters 90cf212cef Essentially SF patch 1061679: add missing __all__ to pickletools.py.
Harmless.
2004-11-06 23:45:48 +00:00
Andrew M. Kuchling d0c53fedd0 Add argument to docstring 2004-08-07 16:51:30 +00:00
Tim Peters 62235e701e dis(): Added an optional memo argument, so that multiple pickles in a
file can be dumped without (bogus) complaint if the the pickles were
created using a single pickle memo.
2003-02-05 19:55:53 +00:00
Tim Peters 4b23f2b44b It's Official: for LONG1/LONG4, a "byte count" of 0 is taken as a
shortcut meaning 0L.  This allows LONG1 to encode 0L in two bytes
total.
2003-01-31 16:43:39 +00:00
Tim Peters 2b93c4c708 Updated the INST/OBJ docs, to say they really are (almost) identical
in 2.3.
2003-01-30 16:35:08 +00:00
Tim Peters 43277d64eb dis(): Simplified stack emulation a bit. 2003-01-30 15:02:12 +00:00
Tim Peters c1c2b3e0e2 dis(): This had a problem with proto 0 pickles, in that POP sometimes
popped a MARK, but without stack emulation the disassembler couldn't
know that, and subsequent indentation got hosed.

Now the disassembler does do enough stack emulation to catch this.  While
I was at it, also added lots of sanity checks for other stack operations,
and correct use of the memo.  This goes (I think) a long way toward being
a "pickle verifier" now too.
2003-01-29 20:12:21 +00:00
Skip Montanaro 5445594e20 minor grammar tweaks 2003-01-29 15:41:33 +00:00
Guido van Rossum ecb1104342 Document the demise of all pretenses of safety, and the difference
between cPickle and pickle.py regarding __safe_for_unpickling__ before
Python 2.3.
2003-01-29 06:24:30 +00:00
Tim Peters 2c60f7a136 Whitespace normalization. 2003-01-29 03:49:43 +00:00
Tim Peters c0c12b5707 pickle: Comment repair.
pickletools:  Import decode_long from pickle instead of duplicating it.
2003-01-29 00:56:17 +00:00
Tim Peters 55762f5f80 Use raw-mode docstring whenever there's an escape code in an example --
they're easier to read this way.
2003-01-28 16:01:25 +00:00
Guido van Rossum 03e35327f2 _dis_test should be a raw string now that it contains \x escapes. 2003-01-28 15:37:13 +00:00
Tim Peters d0f7c86a20 dis(): Not all opcodes are printable anymore, so print the repr
of the opcode character instead (but stripping the quotes).

Added a proto 2 test section for the canonical recursive-tuple case.
Note that since pickle's save_tuple() takes different paths depending on
tuple length now, beefier tests are really needed (but not in pickletools);
the "short tuple" case tried here was actually broken yesterday, and it's
subtle stuff so needs to be tested.
2003-01-28 15:27:57 +00:00
Guido van Rossum 570283584a Fix one disassembly output now that empty tuples are no longer
memoized in text mode.  Fixed some variable names in the disassembler
doctest.
2003-01-28 15:09:10 +00:00
Tim Peters 81098ac1c8 Comments. 2003-01-28 05:12:08 +00:00
Tim Peters fdc03462b3 Now that proto2 is defined, replaced XXX blocks with text about it.
Also moved the proto2 opcode descriptors into the sections they fit (like
TUPLE{1,2,3} in the group of tuple-building opcodes; etc).
2003-01-28 04:56:33 +00:00
Neal Norwitz 784a3f53a8 Use proper function name in exception messages 2003-01-28 00:20:41 +00:00
Tim Peters fdb8cfab08 Removed the new LONG2 opcode: it's extravagant. If LONG1 isn't enough,
then the embedded argument consumes at least 256 bytes.  The difference
between a 3-byte prefix (LONG2 + 2 bytes) and a 5-byte prefix (LONG4 +
4 bytes) is at worst less than 1%.  Note that binary strings and binary
Unicode strings also have only "size is 1 byte, or size is 4 bytes?"
flavors, and I expect for the same reason.  The only place a 2-byte
thingie was used was in BININT2, where the 2 bytes make up the *entire*
embedded argument (and now EXT2 also does this); that's a large savings
over 4 bytes, because the total opcode+argument size is so small in
the BININT2/EXT2 case.

Removed the TAKEN_FROM_ARGUMENT "number of bytes" code, and bifurcated it
into TAKEN_FROM_ARGUMENT1 and TAKEN_FROM_ARGUMENT4.  Now there's enough
info in ArgumentDescriptor objects to deduce the # of bytes consumed by
each opcode.

Rearranged the order in which proto2 opcodes are listed in pickle.py.
2003-01-28 00:13:19 +00:00
Tim Peters bdbe74183c Documented the 2's-comp business for the new long opcodes. 2003-01-27 23:54:04 +00:00
Tim Peters 5eed340267 Whitespace normalization. 2003-01-27 23:51:36 +00:00
Tim Peters 217e571a19 decode_long(): Simplified the "is it negative?" test. 2003-01-27 23:51:11 +00:00
Guido van Rossum f29d3d6011 Begin the change from 'binary vs. text mode' to 'protocol 0, 1, 2'.
The protocol now defaults to 1.  Protocol 2 is still unimplemented.
2003-01-27 22:47:53 +00:00
Guido van Rossum 5a2d8f5e9a Begin documenting protocol 2. 2003-01-27 21:44:25 +00:00
Guido van Rossum a72ded9bc8 Remove a stray quote. 2003-01-27 19:40:47 +00:00
Tim Peters 1996e23054 Repaired comment. 2003-01-27 19:38:34 +00:00
Tim Peters d916cf4ec7 stringnl_noescape_pair(): changed the reader to separate the two
component strings by a blank instead of a period.  Guido pointed
out that the component strings (at least the first one) can be
dotted already.  find_class() is overridable too, so only God knows
all the possibilities that make sense to someone.
2003-01-27 19:01:47 +00:00
Tim Peters 8ecfc8ef9d Moving pickletools.py from the sandbox into the std library. I started
this over the weekend, and it made faster & better progress than I
expected -- it's already useful <wink>.
2003-01-27 18:51:48 +00:00