summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Got test_exceptions.py working.Guido van Rossum2007-05-081-3/+3
|
* Merged revisions 55007-55179 via svnmerge fromGuido van Rossum2007-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines Use the new print syntax, at least. ........ r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line remove old cruftiness ........ r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line make this work with the new Python ........ r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line Get asdl code gen working with Python 2.3. Should continue to work with 3.0 ........ r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line Verify checkins to p3yk (sic) branch go to 3000 list. ........ r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line Fix this test so it runs again by importing warnings_test properly. ........ r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines So long xrange. range() now supports values that are outside -sys.maxint to sys.maxint. floats raise a TypeError. This has been sitting for a long time. It probably has some problems and needs cleanup. Objects/rangeobject.c now uses 4-space indents since it is almost completely new. ........ r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines Fix two tests that were previously depending on significant spaces at the end of a line (and before that on Python 2.x print behavior that has no exact equivalent in 3.0). ........
* Much more pickling now works.Guido van Rossum2007-05-041-4/+7
|
* Checkpoint. Make pickle.py read/write bytes.Guido van Rossum2007-05-041-209/+185
| | | | Fix strict.py so it reads/writes bytes and accepts both string types as format.
* Rip out all the u"..." literals and calls to unicode().Guido van Rossum2007-05-021-7/+7
|
* PEP 3114: rename .next() to .__next__() and add next() builtin.Georg Brandl2007-04-211-2/+2
|
* Hide list comp variables and support set comprehensionsNick Coghlan2007-04-151-1/+0
|
* Fix a bizarre error where test_pickletools fails if preceded by test_pyclbr.Guido van Rossum2007-02-261-1/+1
| | | | | The fix is in neither, but in pickle.py where a loop over sys.modules.items() could modify sys.modules, occasionally.
* - PEP 3106: dict.iterkeys(), .iteritems(), .itervalues() are now gone;Guido van Rossum2007-02-111-1/+1
| | | | | | | | | | and .keys(), .items(), .values() return dict views. The dict views aren't fully functional yet; in particular, they can't be compared to sets yet. but they are useful as "iterator wells". There are still 27 failing unit tests; I expect that many of these have fairly trivial fixes, but there are so many, I could use help.
* Rip out 'long' and 'L'-suffixed integer literals.Guido van Rossum2007-01-151-14/+14
| | | | (Rough first cut.)
* Merged the int/long unification branch, by very crude means (sorry Thomas!).Guido van Rossum2007-01-141-1/+21
| | | | | | | | | | I banged on the code (beyond what's in that branch) to make fewer tests fail; the only tests that fail now are: test_descr -- can't pickle ints?! test_pickletools -- ??? test_socket -- See python.org/sf/1619659 test_sqlite -- ??? I'll deal with those later.
* SF patch 1631942 by Collin Winter:Guido van Rossum2007-01-101-2/+2
| | | | | | (a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
* Get rid of dict.has_key(). Boy this has a lot of repercussions!Guido van Rossum2006-08-181-7/+7
| | | | | | 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-40/+0
| | | | (Collin Winter)
* Revert previous checkin.Raymond Hettinger2005-02-071-15/+15
|
* Reduce the usage of the types module.Raymond Hettinger2005-02-071-15/+15
|
* Eliminate the deprecated option to return None instead of a tuple of ↵Raymond Hettinger2004-12-071-16/+2
| | | | arguments in __reduce__().
* Removed the deprecated bin parameter from the pickle module.Raymond Hettinger2004-12-051-11/+5
|
* Make 'bin' argument trigger DeprecationWarningAndrew M. Kuchling2004-08-071-1/+1
|
* Replace backticks with repr() or "%r"Walter Dörwald2004-02-121-11/+11
| | | | From SF patch #852334.
* Fix grammar in comment.Jeremy Hylton2003-06-291-1/+1
|
* Remove unused _better_reduce (which will disappear soon) andGuido van Rossum2003-02-181-1/+1
| | | | _reconstructor (whose import here is a mystery to me).
* Introducing __reduce_ex__, which is called with a protocol number argumentGuido van Rossum2003-02-181-15/+14
| | | | | if it exists in preference over __reduce__. Now Tim can go implement this in cPickle.c.
* cPickle.c, load_build(): Taught cPickle how to pick apartTim Peters2003-02-151-0/+4
| | | | | | | | | | | | | | | | | | 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.
* Added a HIGHEST_PROTOCOL module attribute to pickle and cPickle.Tim Peters2003-02-131-3/+7
|
* Implemented batching for dicts in cPickle. This is after two failedTim Peters2003-02-111-1/+2
| | | | | 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-0/+1
|
* Rename 'proto' keyword arg to 'protocol' . Greg Ward's suggestion.Guido van Rossum2003-02-091-17/+17
|
* Move _better_reduce from copy.py to copy_reg.py, and also use it inGuido van Rossum2003-02-061-122/+4
| | | | pickle.py, where it makes save_newobj() unnecessary. Tests pass.
* Remove a debug print statement.Guido van Rossum2003-02-061-1/+0
|
* No need for a continuation line.Jeremy Hylton2003-02-061-2/+1
|
* Replace hasattr() + getattr() with single getattr() and default value.Jeremy Hylton2003-02-061-2/+1
|
* Rename the extension registry variables to have leading underscores --Guido van Rossum2003-02-041-5/+5
| | | | | | | | | this clarifies that they are part of an internal API (albeit shared between pickle.py, copy_reg.py and cPickle.c). I'd like to do the same for copy_reg.dispatch_table, but worry that it might be used by existing code. This risk doesn't exist for the extension registry.
* _slotnames(): this is a fairly expensive calculation. Cache theGuido van Rossum2003-02-031-6/+23
| | | | | | | outcome as __slotnames__ on the class. (Like __slots__, it's not safe to ask for this as an attribute -- you must look for it in the specific class's __dict__. But it must be set using attribute notation, because __dict__ is a read-only proxy.)
* _slotnames(): exclude __dict__ and __weakref__; these aren't realGuido van Rossum2003-02-031-1/+2
| | | | slots even though they can be listed in __slots__.
* Support keyword argument 'bin', with a pending deprecation warning.Guido van Rossum2003-02-031-5/+13
|
* cPickle support for TUPLE[123]. Incidentally plugged several undetectedTim Peters2003-02-021-7/+9
| | | | overflow holes in Pdata_grow().
* long(string, base) now takes time linear in len(string) when base is aTim Peters2003-02-021-4/+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-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* The C pickle now knows how to deal with a proto= argument. AssortedTim Peters2003-02-011-11/+9
| | | | code cleanups, and purged more references to text-vs-binary modes.
* Change the default protocol back to 0.Guido van Rossum2003-01-311-8/+12
| | | | | Add a feature suggested by Tim: a negative protocol value means to use the largest protocol value supported.
* Another extension to reduce(). It can return a 4- or 5-tuple now.Guido van Rossum2003-01-311-67/+92
| | | | | | | | | | | | | | The 4th item can be None or an iterator yielding list items, which are used to append() or extend() the object. The 5th item can be None or an iterator yielding a dict's (key, value) pairs, which are stuffed into the object using __setitem__. Also (as a separate, though related, feature) add "batching" for list and dict items. If you pickled a dict or list with a million items in the past, it would push a million items onto the stack. It now pushes only 1000 items at a time on the stack, using repeated APPENDS or SETITEMS opcodes. (For lists, I hope that using many short extend() calls doesn't exhibit quadratic behavior.)
* Provide __module__ attributes for functions defined in C and Python.Jeremy Hylton2003-01-311-3/+6
| | | | | | | | | | | | | | __module__ is the string name of the module the function was defined in, just like __module__ of classes. In some cases, particularly for C functions, the __module__ may be None. Change PyCFunction_New() from a function to a macro, but keep an unused copy of the function around so that we don't change the binary API. Change pickle's save_global() to use whichmodule() if __module__ is None, but add the __module__ logic to whichmodule() since it might be used outside of pickle.
* Pass the object to save_reduce(), so the memoize() call can go intoGuido van Rossum2003-01-311-3/+8
| | | | | save_reduce(), before the state is pickled. This makes it possible for an object to be referenced from its own (mutable) state.
* Add a magical feature to save_reduce so that __reduce__ can causeGuido van Rossum2003-01-311-4/+40
| | | | NEWOBJ to be generated.
* It's Official: for LONG1/LONG4, a "byte count" of 0 is taken as aTim Peters2003-01-311-6/+17
| | | | | shortcut meaning 0L. This allows LONG1 to encode 0L in two bytes total.
* Fix typoNeal Norwitz2003-01-311-1/+1
|
* Linear-time implementations of {encode,decode}_long.Tim Peters2003-01-311-19/+50
|
* load_inst(), load_obj(): Put the bulk of these into a common newTim Peters2003-01-301-26/+18
| | | | _instantiate() method.
* There was a subtle big in save_newobj(): it used self.save_global(t)Guido van Rossum2003-01-301-1/+2
| | | | | | | | | | | | | | | on the type instead of self.save(t). This defeated the purpose of NEWOBJ, because it didn't generate a BINGET opcode when t was already memoized; but moreover, it would generate multiple BINPUT opcodes for the same type! pickletools.dis() doesn't like this. How I found this? I was playing with picklesize.py in the datetime sandbox, and noticed that protocol 2 pickles for multiple objects were in fact larger than protocol 1 pickles! That was suspicious, so I decided to disassemble one of the pickles. This really needs a unit test, but I'm exhausted. I'll be late for work as it is. :-(