summaryrefslogtreecommitdiffstats
path: root/Modules/cPickle.c
Commit message (Collapse)AuthorAgeFilesLines
* Charles Waldman writes:Guido van Rossum2000-04-211-14/+11
| | | | | | | | | | | | | | | | | | | | """ Problem description: Run the following script: import test.test_cpickle for x in xrange(1000000): reload(test.test_cpickle) Watch Python's memory use go up up and away! In the course of debugging this I also saw that cPickle is inconsistent with pickle - if you attempt a pickle.load or pickle.dump on a closed file, you get a ValueError, whereas the corresponding cPickle operations give an IOError. Since cPickle is advertised as being compatible with pickle, I changed these exceptions to match. """
* Marc-Andre Lemburg: support pickling Unicode objects, both in textGuido van Rossum2000-03-101-0/+149
| | | | mode ('V') and in binary mode ('X').
* Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum2000-02-291-11/+11
| | | | PyArg_ParseTuple() format string arguments as possible.
* Patch by Stephen Turner, who writes:Guido van Rossum1999-07-131-18/+27
| | | | | | | | | | | | | | | | | | | | | | | """ It fixes a memory corruption error resulting from BadPickleGet exceptions in load_get, load_binget and load_long_binget. This was initially reported on c.l.py as a problem with Cookie.py; see the thread titled "python core dump (SIGBUS) on Solaris" for more details. If PyDict_GetItem(self->memo, py_key) call failed, then py_key was being Py_DECREF'd out of existence before call was made to PyErr_SetObject(BadPickleGet, py_key). The bug can be duplicated as follows: import cPickle cPickle.loads('garyp') This raises a BadPickleGet exception whose value is a freed object. A core dump will soon follow. """ Jim Fulton approves of the patch.
* New version from Jim:Guido van Rossum1999-06-151-50/+30
| | | | | | | | - Don't call Py_FatalError() when initialization fails. - Fix bogus use of return value from PyRun_String(). - Fix misc. compiler errors on some platforms.
* Jim Fulton writes:Guido van Rossum1999-06-091-10/+56
| | | | | | | | | | | | | | | | | | I've updated cPickle.c to use class exceptions: Changed pickle error types to classes: PickleError PicklingError UnpickleableError UnpicklingError And change the handling of unpickleable objects so that an UnpickleableError is raised with the unpickleable object as the argument. UnpickleableError has a reasonable string representation and provides access to the problem object, which is useful during debugging. [I'm still waiting for patches to do the same to pickle.py.]
* Jim Fulton writes:Guido van Rossum1999-04-191-13/+41
| | | | | | | | | | | | | | I have attached a new cPickle that adds a new control attribute to unpicklers: Added new Unpickler attribute, find_global. If set to None, then global and instance pickles are disabled. Otherwise, it should be set to a callable object that takes two arguments, a module name and an object name, and returns an object. If the attribute is unset, then the default mechanism is used. This feature provides an additional mechanism for controlling which classes can be used for unpickling.
* Fix accidentally reversed NULL test in load_mark(). Suggested byGuido van Rossum1999-04-121-1/+1
| | | | | Tamito Kajiyama. (This caused a bug only on platforms where malloc(0) returns NULL.)
* Protection against picling to/from closed (real) file.Guido van Rossum1999-03-291-0/+8
| | | | The problem was reported by Moshe Zadka.
* Fix buglet in load_put -- the test for bad readline result tested theGuido van Rossum1999-02-081-1/+1
| | | | wrong variable.
* Jim Fulton: this fixes seg faults with bad pickles like "c".Guido van Rossum1999-02-041-3/+22
|
* Make sure not to call realloc() with a NULL pointer -- call malloc()Guido van Rossum1999-01-251-1/+4
| | | | in that case. Tamito Kajiyama.
* Need to initialize self->safe_constructors early on to prevent crashGuido van Rossum1998-12-111-0/+1
| | | | in early dealloc. Patch by Andrew Dalke.
* Make VC++ 5.0 compiler happy.Guido van Rossum1998-12-081-12/+8
|
* Fix two small bugs; add DL_EXPORT() to initcPickle decl.Guido van Rossum1998-12-041-2/+3
|
* New version from Jim Fulton:Guido van Rossum1998-11-251-1172/+1110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - New copyright. (Open source) - Added new protocol for binary string pickles that takes out unneeded puts: p=Pickler() p.dump(x) p.dump(y) thePickle=p.getvalue() This has little or no impact on pickling time, but often reduces unpickling time and pickle size, sometimes significantly. - Changed unpickler to use internal data structure instead of list to reduce unpickling times by about a third. - Many cleanups to get rid of obfuscated error handling involving 'goto finally' and status variables. - Extensive reGuidofication. (formatting :) - Fixed binary floating-point pickling bug. 0.0 was not pickled correctly. - Now use binary floating point format when saving floats in binary mode. - Fixed some error message spelling error.
* Enter Jim Fulton's latest version. He writes:Jeremy Hylton1998-08-131-20/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I had to make a slight diddle to work with Python 1.4, which we and some of our customers are still using. :( I've also made a few minor enhancements: - You can now both get and set the memo using a 'memo' attribute. This is handy for certain advanced applications that we have. - Added a 'binary' attribute to get and set the binary mode for a pickler. - Added a somewhat experimental 'fast' attribute. When this is set, objects are not placed in the memo during pickling. This should lead to faster pickling and smaller pickles in cases where: o you *know* there are no circular references, and o either you've: - preloaded the memo with class information by pickling classes in non-fast mode or by manipilating the memo directly, or - aren't pickling instances.
* Two fixes to find_class:Jeremy Hylton1998-08-111-9/+22
| | | | | | | | | | | | | | | 1. Only DECREF the class's module when the module is retrieved via PyImport_Import. If it is retrieved from the modules dictionary with PyDict_GetItem, it is using a borrowed reference. 2. If the module doesn't define the desired class, raise the same SystemError that pickle.py does instead of returning an AttributeError (which is cryptic at best). Also, fix the PyArg_ParseTuple in cpm_loads (the externally visible loads) function: Use "S" instead of "O" because cStringIO will croak with a "bad arguments to internal function" if passed anything other than a string.
* Jim Fulton's patches to get rid of the class_map().Guido van Rossum1998-08-081-73/+27
|
* Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred() == ... in twoFred Drake1998-05-281-2/+4
| | | | places.
* whichmodule(): remove redundant PyErr_Clear(); add explicit settingGuido van Rossum1998-05-141-4/+3
| | | | of error when sys.modules isn't there.
* Use %.17f to format floats/doublesGuido van Rossum1998-04-031-1/+1
|
* Clear class_map in constructor so that when it later detects an errorGuido van Rossum1998-03-061-1/+2
| | | | and the destructor is called early, it doesn't DECREF garbage.
* Renamed Jim's PyErr_[JF]Format() to cPickle_ErrFormat(). It's not aGuido van Rossum1998-01-191-11/+10
| | | | standard Python API function so it should not have a Py prefix.
* Jim Fulton:Guido van Rossum1997-12-081-24/+50
| | | | | | | | | | | | | | | | | | | | | | - Loading non-binary string pickles checks for insecure strings. This is needed because cPickle (still) uses a restricted eval to parse non-binary string pickles. This change is needed to prevent untrusted pickles like:: "S'hello world'*2000000\012p0\012." from hosing an application. - User-defined types can now support unpickling without executing a constructor. The second value returned from __reduce__ can now be None, rather than an argument tuple. On unpickling, if the second value returned from __reduce__ during pickling was None, then rather than calling the first value returned from __reduce__, directly, the __basicnew__ method of the first value returned from __reduce__ is called without arguments.
* New versions of cPickle and cStringIO, from Jim Fulton's cPickle 1.0b1Guido van Rossum1997-12-041-246/+633
| | | | distribution.
* Initialize __version__ to the correct version string regardless ofGuido van Rossum1997-12-011-3/+14
| | | | | what RCS checkout options are used. Problem first diagnosed by Marc Lemburg.
* In whichmodule(), use __module__ if set.Guido van Rossum1997-09-281-0/+4
|
* #Plug small memory leaks in constructors.Guido van Rossum1997-09-031-2/+5
|
* Removed JF's dollar-Log-dollar RCS turd that caused compilation toBarry Warsaw1997-08-211-52/+0
| | | | | crash due to GvR's last check in message :-). Will try to convince JF to remove all this evilness.
* Added /**/ around #end tagsGuido van Rossum1997-08-211-1/+4
|
* Renamed strndup to pystrndup, to avoid conflicting prototypeGuido van Rossum1997-08-201-5/+9
| | | | in GNU libc on some platforms.
* cPickle release 0.3 from Jim FultonGuido van Rossum1997-08-131-49/+102
|
* Renamed strndup to my_strndup to avoid conflict witth GNU libc.Guido van Rossum1997-05-161-5/+8
|
* Use compile-time test for 64-bit hardware instead of run-time test.Guido van Rossum1997-05-131-1/+9
| | | | This silences some compilers.
* Instead of importing graminit.h whenever one of the three grammar 'root'Guido van Rossum1997-05-071-3/+6
| | | | symbols is needed, define these in Python.h with a Py_ prefix.
* Give PyErr_Format a new name and make it static.Guido van Rossum1997-04-091-0/+5
|
* Jim Fulton's version 2.2.Guido van Rossum1997-04-091-2810/+2931
|
* Eliminated gcc -Wall complaints:Barry Warsaw1997-01-141-26/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Quieted gcc -Wall by removing unused local variables. - Added some choice parentheses around assignments in conditional tests. - Removed an unused (and seemingly unreachable) err label in load_short_binstring(). - in Unpickler_load(), removed \. in string format. - init_stuff() was declared to return an int, but had these problems: - it was returning NULL instead of 0 or 1 in some cases - it was falling of the end of the routine without returning anything - the call of init_stuff() in initcPickle() was never checking the return value anyway. I changed all this by returning 1 in the case of errors, 0 when no error occurred. Then in initcPickle(), if init_stuff() returns non-zero, I call Py_FatalError(). Suppressing my urge to reformat according to Python coding standards! :-)
* cPickle, version 0.1.Guido van Rossum1997-01-061-0/+3767