Commit Graph

67 Commits

Author SHA1 Message Date
Florent Xicluna 02ea12b291 Syntax cleanup. 2010-07-28 16:39:41 +00:00
Alexander Belopolsky 929d384058 Issue #9268: Add annotation option to pickletools.dis 2010-07-17 15:51:21 +00:00
Alexander Belopolsky 44c2ffd38f Corrected TUPLE<N> opcodes' docs. 2010-07-16 14:39:45 +00:00
Alexander Belopolsky 60c762b77a Issue #9094: Make python -m pickletools disassemble pickles given in
the command line.
2010-07-03 20:35:53 +00:00
Victor Stinner 485fb56eb8 Issue #8383: pickle and pickletools use surrogatepass error handler when
encoding unicode as utf8 to support lone surrogates and stay compatible with
Python 2.x and 3.0
2010-04-13 11:07:24 +00:00
Antoine Pitrou d9dfaa9487 Issue #6137: The pickle module now translates module names when loading
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.
2009-06-04 20:32:06 +00:00
Collin Winter e61d4372ed Merge r72792: POP_MARK was not in pickle protocol 0, SHORT_BINBYTES was not in protocol 1. 2009-05-20 17:46:47 +00:00
Mark Dickinson cddcf444b2 Merged revisions 68903,68906 via svnmerge from
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.
........
2009-01-24 21:46:33 +00:00
Mark Dickinson 8dd05147d6 Issue #4842, patch 1/2: fix pickle in Python 3.x so that pickling with the
'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.
2009-01-20 20:43:58 +00:00
Alexandre Vassalotti ca2d610dba Restore _pickle module accelerator module.
Removed Windows support temporarily.
64bit bug with integer unpickling is now fixed.
2008-06-12 18:26:05 +00:00
Benjamin Peterson 75f25f2c9a revert the addition of _pickle because it was causing havok with 64-bit 2008-06-12 03:10:02 +00:00
Alexandre Vassalotti cc313061a5 Issue 2917: Merge the pickle and cPickle module. 2008-06-11 22:43:06 +00:00
Alexandre Vassalotti f7fa63dd55 Rename copy_reg module to copyreg.
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.
........
2008-05-11 08:55:36 +00:00
Guido van Rossum f416981691 - A new pickle protocol (protocol 3) is added with explicit support
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.
2008-03-17 22:56:06 +00:00
Christian Heimes 126d29abf8 Merged revisions 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().
........
2008-02-11 22:57:17 +00:00
Christian Heimes 3feef61742 Merged revisions 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).
........
2008-02-11 06:19:17 +00:00
Georg Brandl 1a3284ed69 #1535: rename __builtin__ module to builtins. 2007-12-02 09:40:06 +00:00
Guido van Rossum 98297ee781 Merging the py3k-pep3137 branch back into the py3k branch.
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.
2007-11-06 21:34:58 +00:00
Georg Brandl bd1c68c94f Patch #1303: Adapt str8 constructor to bytes (now buffer) one. 2007-10-24 18:55:37 +00:00
Guido van Rossum 3172c5d263 Patch# 1258 by Christian Heimes: kill basestring.
I like this because it makes the code shorter! :-)
2007-10-16 18:12:55 +00:00
Jeremy Hylton a5dc3db3d1 Change string literals to bytes, since they are compared to bytes. 2007-08-29 19:07:40 +00:00
Guido van Rossum 26d95c3d07 More str/bytes fixes. 2007-08-27 23:18:54 +00:00
Guido van Rossum 34d1928766 SF patch# 1770008 by Christian Heimes (plus some extras).
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.
2007-08-09 01:03:29 +00:00
Guido van Rossum 99603b0c1e Getting rid of cPickle. Mmm, feels good! 2007-07-20 00:22:32 +00:00
Guido van Rossum 2698631d57 Make test_pickletools.py pass. 2007-07-17 00:19:46 +00:00
Walter Dörwald 42748a8d6d Rip out all codecs that can't work in a unicode/bytes world:
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).
2007-06-12 16:40:17 +00:00
Guido van Rossum 1325790b93 Merged revisions 55795-55816 via svnmerge from
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.
........
2007-06-07 23:15:56 +00:00
Guido van Rossum a8add0ec5e Merged revisions 55270-55324 via svnmerge from
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.
........
2007-05-14 22:03:55 +00:00
Guido van Rossum cfe5f20fe8 Got test_pickletools and test_pickle working.
(Alas, test_cpickle is still broken.)
2007-05-08 21:26:54 +00:00
Guido van Rossum 617dbc4d64 Checkpoint. A b it closer to working pickles and pickletools.
Added 'Y' getargs opcode which requires a bytes object.
2007-05-07 23:57:08 +00:00
Guido van Rossum ef87d6ed94 Rip out all the u"..." literals and calls to unicode(). 2007-05-02 19:09:54 +00:00
Guido van Rossum 4f7ac2e800 Change a test to be more predictable.
The problem with using random.random is that several modules and tests do
"from random in random" which confuses pickle.whichmodule().
2007-02-26 15:59:50 +00:00
Guido van Rossum be19ed77dd Fix most trivially-findable print statements.
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.)
2007-02-09 05:37:30 +00:00
Guido van Rossum e2a383d062 Rip out 'long' and 'L'-suffixed integer literals.
(Rough first cut.)
2007-01-15 16:59:06 +00:00
Guido van Rossum f4100005ae Fix pickletools doctests -- all we get nowadays is longs.
(Hmm... Shouldn't longs of certain sizes be pickled using 'I' opcodes? Later.)
2007-01-15 00:21:46 +00:00
Guido van Rossum e2b70bcf74 Get rid of dict.has_key(). Boy this has a lot of repercussions!
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.
2006-08-18 22:13:04 +00:00
Guido van Rossum 65810fee5e SF patch 1495675: Remove types.InstanceType and new.instance
(Collin Winter)
2006-05-26 19:12:38 +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