summaryrefslogtreecommitdiffstats
path: root/Lib/pickletools.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #8383: pickle and pickletools use surrogatepass error handler whenVictor Stinner2010-04-131-1/+1
| | | | | encoding unicode as utf8 to support lone surrogates and stay compatible with Python 2.x and 3.0
* Issue #6137: The pickle module now translates module names when loadingAntoine Pitrou2009-06-041-85/+85
| | | | | | or dumping pickles with a 2.x-compatible protocol, in order to make data sharing and migration easier. This behaviour can be disabled using the new `fix_imports` optional argument.
* Merge r72792: POP_MARK was not in pickle protocol 0, SHORT_BINBYTES was not ↵Collin Winter2009-05-201-2/+2
| | | | in protocol 1.
* Merged revisions 68903,68906 via svnmerge fromMark Dickinson2009-01-241-5/+5
| | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r68903 | mark.dickinson | 2009-01-24 16:40:29 +0000 (Sat, 24 Jan 2009) | 5 lines Issue #1672332: Fix unpickling of subnormal floats, which was raising ValueError on some platforms as a result of the platform strtod setting errno on underflow. ........ r68906 | mark.dickinson | 2009-01-24 21:08:38 +0000 (Sat, 24 Jan 2009) | 2 lines Issue #3657: fix occasional test_pickletools failures. ........
* Issue #4842, patch 1/2: fix pickle in Python 3.x so that pickling with theMark Dickinson2009-01-201-38/+40
| | | | | | 'L' opcode always appends an 'L' on output, just as 2.x does. When unpickling, remove the trailing 'L' (if present) before passing the result to PyLong_FromString.
* Restore _pickle module accelerator module.Alexandre Vassalotti2008-06-121-10/+12
| | | | | Removed Windows support temporarily. 64bit bug with integer unpickling is now fixed.
* revert the addition of _pickle because it was causing havok with 64-bitBenjamin Peterson2008-06-121-12/+10
|
* Issue 2917: Merge the pickle and cPickle module.Alexandre Vassalotti2008-06-111-10/+12
|
* Rename copy_reg module to copyreg.Alexandre Vassalotti2008-05-111-48/+48
| | | | | | | | | | | | | | | Updated documentation. Merged revisions 63042 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r63042 | alexandre.vassalotti | 2008-05-11 04:25:28 -0400 (Sun, 11 May 2008) | 5 lines Added module stub for copy_reg renaming in 3.0. Renamed copy_reg to copyreg in the standard library, to avoid spurious warnings and ease later merging to py3k branch. Public documentation remains intact. ........
* - A new pickle protocol (protocol 3) is added with explicit supportGuido van Rossum2008-03-171-23/+86
| | | | | | | | | | | | | for bytes. This is the default protocol. It intentionally cannot be unpickled by Python 2.x. - When a pickle written by Python 2.x contains an (8-bit) str instance, this is now decoded to a (Unicode) str instance. The encoding used to do this defaults to ASCII, but can be overridden via two new keyword arguments to the Unpickler class. Previously this would create bytes instances, which is usually wrong: str instances are often used to pickle attribute names etc., and text is more common than binary data anyway.
* Merged revisions ↵Christian Heimes2008-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60734 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r60731 | raymond.hettinger | 2008-02-11 19:51:08 +0100 (Mon, 11 Feb 2008) | 1 line No need to register classes that already inherit from ABCs. ........ r60733 | lars.gustaebel | 2008-02-11 20:17:10 +0100 (Mon, 11 Feb 2008) | 2 lines Make sure that xstar headers are read correctly. ........ r60734 | raymond.hettinger | 2008-02-11 21:05:53 +0100 (Mon, 11 Feb 2008) | 1 line Add tests for pickletools.optimize(). ........
* Merged revisions ↵Christian Heimes2008-02-111-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60706,60708-60712,60714-60724 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r60701 | georg.brandl | 2008-02-09 22:36:15 +0100 (Sat, 09 Feb 2008) | 2 lines Needs only 2.4 now. ........ r60702 | georg.brandl | 2008-02-09 22:38:54 +0100 (Sat, 09 Feb 2008) | 2 lines Docs are rst now. ........ r60703 | georg.brandl | 2008-02-09 23:00:00 +0100 (Sat, 09 Feb 2008) | 2 lines Fix link. ........ r60704 | georg.brandl | 2008-02-10 00:09:25 +0100 (Sun, 10 Feb 2008) | 2 lines Fix for newest doctools. ........ r60709 | raymond.hettinger | 2008-02-10 08:21:09 +0100 (Sun, 10 Feb 2008) | 1 line Clarify that decimal also supports fixed-point arithmetic. ........ r60710 | nick.coghlan | 2008-02-10 08:32:52 +0100 (Sun, 10 Feb 2008) | 1 line Add missing NEWS entry for r60695 ........ r60712 | mark.dickinson | 2008-02-10 15:58:38 +0100 (Sun, 10 Feb 2008) | 3 lines Turn classmethods into staticmethods, and avoid calling the constructor of subclasses of Rational. (See discussion in issue #1682.) ........ r60715 | mark.dickinson | 2008-02-10 16:19:58 +0100 (Sun, 10 Feb 2008) | 2 lines Typos in decimal comment and documentation ........ r60716 | skip.montanaro | 2008-02-10 16:31:54 +0100 (Sun, 10 Feb 2008) | 2 lines Get the saying right. ;-) ........ r60717 | skip.montanaro | 2008-02-10 16:32:16 +0100 (Sun, 10 Feb 2008) | 2 lines whoops - revert ........ r60718 | mark.dickinson | 2008-02-10 20:23:36 +0100 (Sun, 10 Feb 2008) | 2 lines Remove reference to Rational ........ r60719 | raymond.hettinger | 2008-02-10 21:35:16 +0100 (Sun, 10 Feb 2008) | 1 line Complete an open todo on pickletools -- add a pickle optimizer. ........ r60721 | mark.dickinson | 2008-02-10 22:29:51 +0100 (Sun, 10 Feb 2008) | 3 lines Rename rational.Rational to fractions.Fraction, to avoid name clash with numbers.Rational. See issue #1682 for related discussion. ........ r60722 | christian.heimes | 2008-02-11 03:26:22 +0100 (Mon, 11 Feb 2008) | 1 line The test requires the network resource ........ r60723 | mark.dickinson | 2008-02-11 04:11:55 +0100 (Mon, 11 Feb 2008) | 3 lines Put an extra space into the repr of a Fraction: Fraction(1, 2) instead of Fraction(1,2). ........
* #1535: rename __builtin__ module to builtins.Georg Brandl2007-12-021-36/+36
|
* Merging the py3k-pep3137 branch back into the py3k branch.Guido van Rossum2007-11-061-10/+13
| | | | | | | | | | | | | | No detailed change log; just check out the change log for the py3k-pep3137 branch. The most obvious changes: - str8 renamed to bytes (PyString at the C level); - bytes renamed to buffer (PyBytes at the C level); - PyString and PyUnicode are no longer compatible. I.e. we now have an immutable bytes type and a mutable bytes type. The behavior of PyString was modified quite a bit, to make it more bytes-like. Some changes are still on the to-do list.
* Patch #1303: Adapt str8 constructor to bytes (now buffer) one.Georg Brandl2007-10-241-1/+1
|
* Patch# 1258 by Christian Heimes: kill basestring.Guido van Rossum2007-10-161-5/+5
| | | | I like this because it makes the code shorter! :-)
* Change string literals to bytes, since they are compared to bytes.Jeremy Hylton2007-08-291-2/+2
|
* More str/bytes fixes.Guido van Rossum2007-08-271-4/+4
|
* SF patch# 1770008 by Christian Heimes (plus some extras).Guido van Rossum2007-08-091-2/+2
| | | | | | | | | | Completely get rid of StringIO.py and cStringIO.c. I had to fix a few tests and modules beyond what Christian did, and invent a few conventions. E.g. in elementtree, I chose to write/return Unicode strings whe no encoding is given, but bytes when an explicit encoding is given. Also mimetools was made to always assume binary files.
* Getting rid of cPickle. Mmm, feels good!Guido van Rossum2007-07-201-6/+4
|
* Make test_pickletools.py pass.Guido van Rossum2007-07-171-34/+20
|
* Rip out all codecs that can't work in a unicode/bytes world:Walter Dörwald2007-06-121-3/+3
| | | | | | | | base64, uu, zlib, rot_13, hex, quopri, bz2, string_escape. However codecs.escape_encode() and codecs.escape_decode() still exist, as they are used for pickling str8 objects (so those two functions can go, when the str8 type is removed).
* Merged revisions 55795-55816 via svnmerge fromGuido van Rossum2007-06-071-4/+1
| | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines Get rid of some remnants of classic classes. types.ClassType == type. Also get rid of almost all uses of the types module and use the builtin name. ........ r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line Remove a use of types, verify commit hook works ........ r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines Fix syntax error introduced by Neal in last checkin. ........
* Merged revisions 55270-55324 via svnmerge fromGuido van Rossum2007-05-141-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55271 | fred.drake | 2007-05-11 10:14:47 -0700 (Fri, 11 May 2007) | 3 lines remove jpeg, panel libraries for SGI; there is more IRIX stuff left over, I guess that should be removed too, but will leave for someone who is sure ........ r55280 | fred.drake | 2007-05-11 19:11:37 -0700 (Fri, 11 May 2007) | 1 line remove mention of file that has been removed ........ r55301 | brett.cannon | 2007-05-13 17:38:05 -0700 (Sun, 13 May 2007) | 4 lines Remove rexec and Bastion from the stdlib. This also eliminates the need for f_restricted on frames. This in turn negates the need for PyEval_GetRestricted() and PyFrame_IsRestricted(). ........ r55303 | brett.cannon | 2007-05-13 19:22:22 -0700 (Sun, 13 May 2007) | 2 lines Remove the md5 and sha modules. ........ r55305 | george.yoshida | 2007-05-13 19:45:55 -0700 (Sun, 13 May 2007) | 2 lines fix markup ........ r55306 | neal.norwitz | 2007-05-13 19:47:57 -0700 (Sun, 13 May 2007) | 1 line Get the doc building again after some removals. ........ r55307 | neal.norwitz | 2007-05-13 19:50:45 -0700 (Sun, 13 May 2007) | 1 line Get test_pyclbr passing again after getstatus was removed from commands. This "test case" was weird since it was just importing a seemingly random module. Remove the import ........ r55322 | brett.cannon | 2007-05-14 14:09:20 -0700 (Mon, 14 May 2007) | 3 lines Remove the compiler package. Will eventually need a mechanism to byte compile an AST. ........
* Got test_pickletools and test_pickle working.Guido van Rossum2007-05-081-80/+94
| | | | (Alas, test_cpickle is still broken.)
* Checkpoint. A b it closer to working pickles and pickletools.Guido van Rossum2007-05-071-1/+2
| | | | Added 'Y' getargs opcode which requires a bytes object.
* Rip out all the u"..." literals and calls to unicode().Guido van Rossum2007-05-021-3/+3
|
* Change a test to be more predictable.Guido van Rossum2007-02-261-4/+4
| | | | | The problem with using random.random is that several modules and tests do "from random in random" which confuses pickle.whichmodule().
* Fix most trivially-findable print statements.Guido van Rossum2007-02-091-8/+8
| | | | | | | | | There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
* Rip out 'long' and 'L'-suffixed integer literals.Guido van Rossum2007-01-151-5/+5
| | | | (Rough first cut.)
* Fix pickletools doctests -- all we get nowadays is longs.Guido van Rossum2007-01-151-5/+5
| | | | (Hmm... Shouldn't longs of certain sizes be pickled using 'I' opcodes? Later.)
* Get rid of dict.has_key(). Boy this has a lot of repercussions!Guido van Rossum2006-08-181-21/+12
| | | | | | Not all code has been fixed yet; this is just a checkpoint... The C API still has PyDict_HasKey() and _HasKeyString(); not sure if I want to change those just yet.
* SF patch 1495675: Remove types.InstanceType and new.instanceGuido van Rossum2006-05-261-30/+46
| | | | (Collin Winter)
* An instance of class PicklingError was used here simply as an example ofTim Peters2005-02-151-21/+26
| | | | | | | _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.
* Remove reference to old pickle feature.Raymond Hettinger2004-12-071-5/+0
|
* Essentially SF patch 1061679: add missing __all__ to pickletools.py.Tim Peters2004-11-061-0/+4
| | | | Harmless.
* Add argument to docstringAndrew M. Kuchling2004-08-071-1/+1
|
* dis(): Added an optional memo argument, so that multiple pickles in aTim Peters2003-02-051-2/+38
| | | | | file can be dumped without (bogus) complaint if the the pickles were created using a single pickle memo.
* It's Official: for LONG1/LONG4, a "byte count" of 0 is taken as aTim Peters2003-01-311-3/+8
| | | | | shortcut meaning 0L. This allows LONG1 to encode 0L in two bytes total.
* Updated the INST/OBJ docs, to say they really are (almost) identicalTim Peters2003-01-301-0/+6
| | | | in 2.3.
* dis(): Simplified stack emulation a bit.Tim Peters2003-01-301-14/+16
|
* dis(): This had a problem with proto 0 pickles, in that POP sometimesTim Peters2003-01-291-17/+113
| | | | | | | | | | 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.
* minor grammar tweaksSkip Montanaro2003-01-291-5/+5
|
* Document the demise of all pretenses of safety, and the differenceGuido van Rossum2003-01-291-4/+17
| | | | | between cPickle and pickle.py regarding __safe_for_unpickling__ before Python 2.3.
* Whitespace normalization.Tim Peters2003-01-291-4/+4
|
* pickle: Comment repair.Tim Peters2003-01-291-23/+2
| | | | pickletools: Import decode_long from pickle instead of duplicating it.
* Use raw-mode docstring whenever there's an escape code in an example --Tim Peters2003-01-281-42/+42
| | | | they're easier to read this way.
* _dis_test should be a raw string now that it contains \x escapes.Guido van Rossum2003-01-281-1/+1
|
* dis(): Not all opcodes are printable anymore, so print the reprTim Peters2003-01-281-126/+150
| | | | | | | | | | 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.
* Fix one disassembly output now that empty tuples are no longerGuido van Rossum2003-01-281-12/+11
| | | | | memoized in text mode. Fixed some variable names in the disassembler doctest.