summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
Commit message (Collapse)AuthorAgeFilesLines
* Merged revisions 77352-77354 via svnmerge fromAntoine Pitrou2010-01-071-0/+9
| | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77352 | antoine.pitrou | 2010-01-07 18:46:49 +0100 (jeu., 07 janv. 2010) | 5 lines Issue #7455: Fix possible crash in cPickle on invalid input. Patch by Florent Xicluna. ........ r77353 | antoine.pitrou | 2010-01-07 18:49:37 +0100 (jeu., 07 janv. 2010) | 3 lines Fix attribution. Florent actually repackaged and reviewed Victor's patch (sorry!). ........ r77354 | antoine.pitrou | 2010-01-07 18:54:10 +0100 (jeu., 07 janv. 2010) | 3 lines Fix reattribution mistake when fixing attribution mistake! ........
* Merged revisions 76499 via svnmerge fromAlexandre Vassalotti2009-11-241-0/+10
| | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r76499 | alexandre.vassalotti | 2009-11-24 12:53:23 -0500 (Tue, 24 Nov 2009) | 9 lines Issue 7128: Removed reference to the non-existent copyreg module. The reference to copyreg was a unnoticed leftover from the compatibility support for the grand renaming of the standard library in Python 3. The compatibility support was reverted in r63493, but not completely as this patch shows. Based on a patch by Amaury Forgeot d'Arc. ........
* Merged revisions 74189 via svnmerge fromAmaury Forgeot d'Arc2009-07-231-0/+5
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r74189 | amaury.forgeotdarc | 2009-07-23 21:26:02 +0200 (jeu., 23 juil. 2009) | 4 lines #6553: crash in cPickle.load(), when given a StringIO with incomplete data. Will backport to 2.6, 3.x already fixed a similar issue with issue4298. ........
* Merged revisions 72930 via svnmerge fromCollin Winter2009-05-261-0/+10
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r72930 | collin.winter | 2009-05-25 21:12:39 -0700 (Mon, 25 May 2009) | 1 line Issue 5794: fix cPickle's unpickling of recursive tuples. ........
* Merged revisions 68903,68906 via svnmerge fromMark Dickinson2009-01-241-0/+10
| | | | | | | | | | | | | | | | 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. ........
* Merged revisions ↵Benjamin Peterson2008-12-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 67898,67904-67907,67912,67918,67920-67921,67923-67924,67927,67930,67932,67943 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r67898 | benjamin.peterson | 2008-12-21 15:00:53 -0600 (Sun, 21 Dec 2008) | 1 line compute DISTVERSION with patchlevel.py ........ r67904 | benjamin.peterson | 2008-12-22 14:44:58 -0600 (Mon, 22 Dec 2008) | 1 line less attitude ........ r67905 | benjamin.peterson | 2008-12-22 14:51:15 -0600 (Mon, 22 Dec 2008) | 1 line fix #4720: the format to PyArg_ParseTupleAndKeywords can now start with '|' ........ r67906 | benjamin.peterson | 2008-12-22 14:52:53 -0600 (Mon, 22 Dec 2008) | 1 line add NEWS note ........ r67907 | benjamin.peterson | 2008-12-22 16:12:19 -0600 (Mon, 22 Dec 2008) | 1 line silence compiler warning ........ r67912 | georg.brandl | 2008-12-23 06:37:21 -0600 (Tue, 23 Dec 2008) | 2 lines Fix missing "svn" command. ........ r67918 | georg.brandl | 2008-12-23 09:44:25 -0600 (Tue, 23 Dec 2008) | 2 lines Markup fix. ........ r67920 | benjamin.peterson | 2008-12-23 14:09:28 -0600 (Tue, 23 Dec 2008) | 1 line use a global variable, so the compiler doesn't optimize the assignment out ........ r67921 | benjamin.peterson | 2008-12-23 14:12:33 -0600 (Tue, 23 Dec 2008) | 1 line make global static ........ r67923 | benjamin.peterson | 2008-12-24 09:10:27 -0600 (Wed, 24 Dec 2008) | 1 line #4736 BufferRWPair.closed shouldn't try to call another property as a function ........ r67924 | benjamin.peterson | 2008-12-24 10:10:05 -0600 (Wed, 24 Dec 2008) | 1 line pretend exceptions don't exist a while longer ........ r67927 | benjamin.peterson | 2008-12-26 17:26:30 -0600 (Fri, 26 Dec 2008) | 1 line python version is included in file name now ........ r67930 | hirokazu.yamamoto | 2008-12-26 22:19:48 -0600 (Fri, 26 Dec 2008) | 2 lines Issue #4740: Use HIGHEST_PROTOCOL in pickle test. (There is no behavior difference in 2.x because HIGHEST_PROTOCOL == 2) ........ r67932 | alexandre.vassalotti | 2008-12-27 00:36:10 -0600 (Sat, 27 Dec 2008) | 5 lines Remove unnecessary casts related to unicode_decode_call_errorhandler. Make the _PyUnicode_Resize macro a static function. These changes are needed to avoid breaking strict aliasing rules. ........ r67943 | alexandre.vassalotti | 2008-12-27 04:02:59 -0600 (Sat, 27 Dec 2008) | 2 lines Fix bogus unicode tests in pickletester. ........
* Merged revisions 67934-67935 via svnmerge fromAlexandre Vassalotti2008-12-271-2/+9
| | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r67934 | alexandre.vassalotti | 2008-12-27 02:08:47 -0500 (Sat, 27 Dec 2008) | 4 lines Fix issue #4730: cPickle corrupts high-unicode strings. Update outdated copy of PyUnicode_EncodeRawUnicodeEscape. Add a test case. ........ r67935 | alexandre.vassalotti | 2008-12-27 02:13:01 -0500 (Sat, 27 Dec 2008) | 2 lines Add Misc/NEWS entry for r67934. ........
* Issue #4176: Pickle would crash the interpreter when a __reduce__ functionAmaury Forgeot d'Arc2008-10-301-0/+23
| | | | | | | does not return an iterator for the 4th and 5th items. (sequence-like and mapping-like state) Backport of r67049
* Revert copy_reg -> copyreg rename.Georg Brandl2008-05-201-9/+9
|
* Added module stub for copy_reg renaming in 3.0.Alexandre Vassalotti2008-05-111-9/+9
| | | | | | Renamed copy_reg to copyreg in the standard library, to avoid spurious warnings and ease later merging to py3k branch. Public documentation remains intact.
* Patch #1462488: prevent a segfault in object_reduce_ex() by splittingŽiga Seilnacht2007-03-151-0/+32
| | | | | the implementation for __reduce__ and __reduce_ex__ into two separate functions. Fixes bug #931877. Will backport.
* Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.Georg Brandl2006-04-301-1/+7
| | | | | On the way, add a decorator to test_support to facilitate running single test functions in different locales with automatic cleanup.
* Patch #995766: Keyword argument support in cPickle.Martin v. Löwis2004-07-271-0/+10
|
* Deleting cyclic object comparison.Armin Rigo2003-10-281-15/+10
| | | | | SF patch 825639 http://mail.python.org/pipermail/python-dev/2003-October/039445.html
* MyComplex now works.Guido van Rossum2003-03-021-1/+1
|
* test_load_from_canned_string(): Created a DATA2 string to test a cannedTim Peters2003-03-021-2/+66
| | | | proto 2 pickle too.
* Three test cases for __reduce_ex__. This fails for cPickle, until TimGuido van Rossum2003-02-181-0/+52
| | | | checks in his changes to support this in cPickle.c.
* cPickle.c, load_build(): Taught cPickle how to pick apartTim Peters2003-02-151-6/+1
| | | | | | | | | | | | | | | | | | the optional proto 2 slot state. pickle.py, load_build(): CAUTION: Noted that cPickle's load_build and pickle's load_build really don't do the same things with the state, and didn't before this patch either. cPickle never tries to do .update(), and has no backoff if instance.__dict__ can't be retrieved. There are no tests that can tell the difference, and part of what cPickle's load_build() did looked accidental to me, so I don't know what the true intent is here. pickletester.py, test_pickle.py: Got rid of the hack for exempting cPickle from running some of the proto 2 tests. dictobject.c, PyDict_Next(): documented intended use.
* cPickle produces NEWOBJ appropriately now. It still doesn't knowTim Peters2003-02-141-6/+6
| | | | how to unpickle the new slot-full state tuples.
* We didn't have any tests making pickles with one of {pickle, cPickle},Tim Peters2003-02-131-0/+5
| | | | | | | and loading them via the other, except for the special cases of this Guido added to test_datetime.py for datetime module objects. The new test_xpickle.py tries all of pickletester's AbstractPickleTests in both x-module ways.
* Added a simple NEWOBJ test. This is in the pickle-only part of theTim Peters2003-02-131-0/+15
| | | | test for now (cPickle can't yet produce NEWOBJ).
* Added a HIGHEST_PROTOCOL module attribute to pickle and cPickle.Tim Peters2003-02-131-2/+4
|
* Implemented batching for dicts in cPickle. This is after two failedTim Peters2003-02-111-17/+17
| | | | | attempts to merge the C list-batch and dict-batch code -- they worked, but it was a godawful mess to read.
* Implemented list batching in cPickle.Tim Peters2003-02-111-17/+17
|
* Added tests to ensure that list and dict "chunking" are actuallyTim Peters2003-02-111-1/+51
| | | | | | getting done. Since this isn't yet implemented in cPickle, the new tests are in TempAbstractPickleTests (which cPickle doesn't run).
* cPickle: exempt two_tuple from GC -- it's a speed hack, and doesn'tTim Peters2003-02-041-11/+53
| | | | | | | | | | | | guarantee to keep valid pointers in its slots. tests: Moved ExtensionSaver from test_copy_reg into pickletester, and use it both places. Once extension codes get assigned, it won't be safe to overwrite them willy nilly in test suites, and ExtensionSaver does a thorough job of undoing any possible damage. Beefed up the EXT[124] tests a bit, to check the smallest and largest codes in each opcode's range too.
* cPickle now generates proto 2 EXT[124] when appropriate.Tim Peters2003-02-041-18/+18
| | | | | Moved such EXT tests as currently exist from TempAbstractPickleTests to AbstractPickleTests, so that test_cpickle runs them too.
* test_newobj_tuple(), test_newobj_list(): These tests should work underTim Peters2003-02-031-8/+10
| | | | all protocols, so tried them under all.
* test_newobj_generic(): Use the global protocols vector instead of aTim Peters2003-02-031-1/+1
| | | | hardcoded list.
* Added a bit to the EXT[124] tests, and refactored them to squash codeTim Peters2003-02-031-51/+27
| | | | duplication. Note that these still don't get run under cPickle.
* Do a better job of testing that opcodes aren't generated under protocolsTim Peters2003-02-031-18/+32
| | | | earlier than the ones in which they were introduced.
* Proper testing of proto 2 in part requires checking that the new opcodesTim Peters2003-02-031-11/+10
| | | | | | are actually getting generated. Add helpered method ensure_opcode_in_pickle to do a correct job checking for that. Changed test_long1(), test_long4(), and test_short_tuples() to use it.
* cPickle support for TUPLE[123]. Incidentally plugged several undetectedTim Peters2003-02-021-0/+31
| | | | overflow holes in Pdata_grow().
* Implemented proto 2 NEWTRUE and NEWFALSE in cPickle.Tim Peters2003-02-021-0/+6
|
* Beefed up the tests by putting in more "for proto in protocols:" outerTim Peters2003-02-021-86/+231
| | | | | | | loops. Renamed DATA and BINDATA to DATA0 and DATA1. Included disassemblies, but noted why we can't test them. Added XXX comment to cPickle about a mysterious comment, where pickle and cPickle diverge in how they number PUT indices.
* Add cPickle support for PROTO. Duplicated PROTO/LONG1/LONG4 code inTim Peters2003-02-021-2/+23
| | | | | the hitherto unknown (to me) noload() cPickle function, which is (a) something we don't test at all, and (b) pickle.py doesn't have.
* long(string, base) now takes time linear in len(string) when base is aTim Peters2003-02-021-10/+1
| | | | | power of 2. Enabled the tail end of test_long() in pickletester.py because it no longer takes forever when run from test_pickle.py.
* cPickle.c: Full support for the new LONG1 and LONG4. Added comments.Tim Peters2003-02-021-11/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assorted code cleanups; e.g., sizeof(char) is 1 by definition, so there's no need to do things like multiply by sizeof(char) in hairy malloc arguments. Fixed an undetected-overflow bug in readline_file(). longobject.c: Fixed a really stupid bug in the new _PyLong_NumBits. pickle.py: Fixed stupid bug in save_long(): When proto is 2, it wrote LONG1 or LONG4, but forgot to return then -- it went on to append the proto 1 LONG opcode too. Fixed equally stupid cancelling bugs in load_long1() and load_long4(): they *returned* the unpickled long instead of pushing it on the stack. The return values were ignored. Tests passed before only because save_long() pickled the long twice. Fixed bugs in encode_long(). Noted that decode_long() is quadratic-time despite our hopes, because long(string, 16) is still quadratic-time in len(string). It's hex() that's linear-time. I don't know a way to make decode_long() linear-time in Python, short of maybe transforming the 256's-complement bytes into marshal's funky internal format, and letting marshal decode that. It would be more valuable to make long(string, 16) linear time. pickletester.py: Added a global "protocols" vector so tests can try all the protocols in a sane way. Changed test_ints() and test_unicode() to do so. Added a new test_long(), but the tail end of it is disabled because it "takes forever" under pickle.py (but runs very quickly under cPickle: cPickle proto 2 for longs is linear-time).
* Removed all uses of the out-of-favor __safe_for_unpickling__ magicTim Peters2003-02-011-2/+0
| | | | attr, and copy_reg.safe_constructors.
* Implement appropriate __getnewargs__ for all immutable subclassable builtinGuido van Rossum2003-01-291-2/+44
| | | | | | | | types. The special handling for these can now be removed from save_newobj(). Add some testing for this. Also add support for setting the 'fast' flag on the Python Pickler class, which suppresses use of the memo.
* Test all three EXT opcodes, and move these tests intoGuido van Rossum2003-01-291-0/+61
| | | | TempAbstractPickleTests, because they don't work with cPickle yet.
* Temporary hacks to arrange that the pickle tests relying on protocol 2Tim Peters2003-01-281-0/+6
| | | | | | only get run by test_pickle.py now (& not by test_cpickle.py). This should be undone when protocol 2 is implemented in cPickle too. test_cpickle should pass again.
* Add a test for a list subclass with a __dict__ as well as slots.Guido van Rossum2003-01-281-0/+17
|
* The default __reduce__ on the base object type obscured anyGuido van Rossum2003-01-281-23/+14
| | | | | | possibility of calling save_reduce(). Add a special hack for this. The tests for this are much simpler now (no __getstate__ or __getnewargs__ needed).
* Some experimental support for generating NEWOBJ with proto=2, andGuido van Rossum2003-01-281-0/+39
| | | | fixed a bug in load_newobj().
* OK, this is really the last one tonight!Guido van Rossum2003-01-281-0/+7
| | | | NEWFALSE and NEWTRUE.
* Shouldn't test short tuples with all items equal -- one potential bugGuido van Rossum2003-01-281-4/+4
| | | | | | | would be that the tuple is reversed on unpickling, and we should catch that. :-) Goodnight -- that's it for toniht!
* More protocol 2: TUPLE1, TUPLE2, TUPLE3.Guido van Rossum2003-01-281-0/+12
| | | | Also moved the special case for empty tuples from save() to save_tuple().
* First baby steps towards implementing protocol 2: PROTO, LONG1 and LONG4.Guido van Rossum2003-01-281-0/+14
|
* Add some simple tests of the persistence hooks.Jeremy Hylton2002-11-131-0/+35
|