summaryrefslogtreecommitdiffstats
path: root/Modules/cPickle.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #1672332: Fix unpickling of subnormal floats, which was raisingMark Dickinson2009-01-241-1/+2
| | | | | ValueError on some platforms as a result of the platform strtod setting errno on underflow.
* Issue #4051: Prevent conflict of UNICODE macros in cPickle.Martin v. Löwis2009-01-021-0/+8
|
* Fix issue #4730: cPickle corrupts high-unicode strings.Alexandre Vassalotti2008-12-271-30/+79
| | | | | Update outdated copy of PyUnicode_EncodeRawUnicodeEscape. Add a test case.
* Issue #4176: Pickle would crash the interpreter when a __reduce__ functionAmaury Forgeot d'Arc2008-10-301-26/+33
| | | | | | | | | does not return an iterator for the 4th and 5th items. (sequence-like and mapping-like state) A list is not an iterator... Will backport to 2.6 and 2.5.
* #3640: Correct a crash in cPickle on 64bit platforms, in the case of deeply ↵Amaury Forgeot d'Arc2008-09-111-64/+117
| | | | | | nested lists or dicts. Reviewed by Martin von Loewis.
* Fix #2702, with a correct accounting of recursion.Facundo Batista2008-06-301-10/+14
|
* Reverting the patch from #3165, as it broke otherFacundo Batista2008-06-251-4/+0
| | | | | | | | | behaviours. I left the original test commented out (note that that test came from #2702, which seems to have a problem in FreeBSD and Windows, but not in Linux). I included a new test, to watch over the now-broken behaviour, I took it from #3179.
* Fix compilation on Windows.Thomas Heller2008-06-231-2/+4
|
* Fixing the problem stated in issue 2702 with the patch submittedFacundo Batista2008-06-221-0/+2
| | | | | in the issue 3165. Now cPickle does not fails with uncontrolled behaviour when pickling into a very deep nested structure.
* Issue 3164. Small fix to don't repeat a comparationFacundo Batista2008-06-221-0/+2
| | | | without necessity.
* Merge in release25-maint r60793:Gregory P. Smith2008-06-111-0/+16
| | | | | | Added checks for integer overflows, contributed by Google. Some are only available if asserts are left in the code, in cases where they can't be triggered from Python code.
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-64/+64
| | | | | | | http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-64/+64
|
* Revert copy_reg -> copyreg rename.Georg Brandl2008-05-201-7/+7
|
* Added Python 3.0 warning to cPickle.Alexandre Vassalotti2008-05-161-0/+6
|
* Added module stub for copy_reg renaming in 3.0.Alexandre Vassalotti2008-05-111-16/+16
| | | | | | Renamed copy_reg to copyreg in the standard library, to avoid spurious warnings and ease later merging to py3k branch. Public documentation remains intact.
* Use the new PyFile_IncUseCount & PyFile_DecUseCount calls appropriatlyGregory P. Smith2008-04-071-0/+4
| | | | | within the standard library. These modules use PyFile_AsFile and later release the GIL while operating on the previously returned FILE*.
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-11/+11
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* Fix Coverity #159.Neal Norwitz2007-10-051-1/+1
| | | | | | | This code was broken if save() returned a negative number since i contained a boolean value and then we compared i < 0 which should never be true. Will backport (assuming it's necessary)
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-16/+14
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Merge change 54909 from release25-maint: Fix several minor issues ↵Kristján Valur Jónsson2007-04-251-7/+12
| | | | discovered using code analysis in VisualStudio 2005 Team Edition
* Forward-port of r52136,52138: a review of overflow-detecting code.Armin Rigo2006-10-041-4/+8
| | | | | | | | | | | | | | | | | | | | | | | * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests...
* Prevent memory leak on error.Neal Norwitz2006-08-021-1/+1
| | | | Reported by Klocwork #36
* Fix memory leaks spotted by Klocwork #37.Neal Norwitz2006-07-231-2/+2
|
* Fix more memory allocation issues found with failmalloc.Neal Norwitz2006-07-221-4/+9
|
* Fix bug #1512695: cPickle.loads could crash if it was interrupted withNeal Norwitz2006-06-281-2/+6
| | | | | | a KeyboardInterrupt since PyTuple_Pack was passed a NULL. Will backport.
* Make use of METH_O and METH_NOARGS where possible.Georg Brandl2006-05-291-22/+9
| | | | Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
* Conversion of exceptions over from faked-up classes to new-style C types.Richard Jones2006-05-271-2/+0
|
* Replace PyObject_CallFunction calls with only object argsGeorg Brandl2006-05-251-2/+2
| | | | with PyObject_CallFunctionObjArgs, which is 30% faster.
* Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.Georg Brandl2006-04-301-1/+3
| | | | | On the way, add a decorator to test_support to facilitate running single test functions in different locales with automatic cleanup.
* Use Py_VISIT in all tp_traverse methods, instead of traversing manually orThomas Wouters2006-04-151-34/+17
| | | | | | | | using a custom, nearly-identical macro. This probably changes how some of these functions are compiled, which may result in fractionally slower (or faster) execution. Considering the nature of traversal, visiting much of the address space in unpredictable patterns, I'd argue the code readability and maintainability is well worth it ;P
* Use Py_CLEAR instead of in-place DECREF/XDECREF or custom macros, forThomas Wouters2006-04-151-21/+17
| | | | tp_clear methods.
* Fix some warnings on HP-UX when using cc/aCCNeal Norwitz2006-04-101-2/+1
|
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-3/+3
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-26/+36
|
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-10/+10
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Eliminate the deprecated option to return None instead of a tuple of ↵Raymond Hettinger2004-12-071-11/+6
| | | | arguments in __reduce__().
* Patch #995766: Keyword argument support in cPickle.Martin v. Löwis2004-07-271-15/+21
|
* Patch #774665: Make Python LC_NUMERIC agnostic.Martin v. Löwis2004-06-081-1/+1
|
* made cPickle fall back to the copy_reg/reduce protocol,Christian Tismer2004-02-261-0/+5
| | | | | if a function cannot be stored as global. This is for compatibility with pickle.py .
* Simplify and speedup uses of Py_BuildValue():Raymond Hettinger2003-10-121-1/+1
| | | | | | * Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c) * Py_BuildValue("()",a) --> PyTuple_New(0) * Py_BuildValue("O", a) --> Py_INCREF(a)
* The Unpickler forget about its find_class attribute.Jeremy Hylton2003-07-111-0/+3
|
* Remove many blanket try/except clauses.Jeremy Hylton2003-06-161-11/+40
| | | | | | | | | | | | SF bug [ 751276 ] cPickle doesn't raise error, pickle does (recursiondepth) Most of the calls to PyErr_Clear() were intended to catch & clear an attribute error and try something different. Guard all those cases with a PyErr_ExceptionMatches() and fail if some other error occurred. The other error is likely a bug in the user code. This is basically the C equivalent of changing "except:" to "except AttributeError:"
* PyType_Ready(): Complain if the type is a base type, and gc'able, andTim Peters2003-05-211-2/+7
| | | | | | | | | | | | | | | | | | tp_free is NULL or PyObject_Del at the end. Because it's a base type it must call tp_free in its dealloc function, and because it's gc'able it must not call PyObject_Del. inherit_slots(): Don't inherit tp_free unless the type and its base agree about whether they're gc'able. If the type is gc'able and the base is not, and the base uses the default PyObject_Del for its tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate default for a gc'able type). cPickle.c: The Pickler and Unpickler types claim to be base classes and gc'able, but their dealloc functions didn't call tp_free. Repaired that. Also call PyType_Ready() on these typeobjects, so that the correct (PyObject_GC_Del) default memory-freeing function gets plugged into these types' tp_free slots.
* Make Unpickler objects colletable.Jeremy Hylton2003-04-091-23/+65
| | | | Bugfix candidate.
* Make Picklers collectable.Jeremy Hylton2003-04-091-5/+45
| | | | Bug fix candidate.
* New private API functions _PyFloat_{Pack,Unpack}(4,8}. This is aTim Peters2003-03-201-154/+9
| | | | | refactoring to get all the duplicates of this delicate code out of the cPickle and struct modules.
* SF bug 705836: struct.pack of floats in non-native endian orderTim Peters2003-03-201-6/+24
| | | | | | | | | | | | | | pack_float, pack_double, save_float: All the routines for creating IEEE-format packed representations of floats and doubles simply ignored that rounding can (in rare cases) propagate out of a long string of 1 bits. At worst, the end-off carry can (by mistake) interfere with the exponent value, and then unpacking yields a result wrong by a factor of 2. In less severe cases, it can end up losing more low-order bits than intended, or fail to catch overflow *caused* by rounding. Bugfix candidate, but I already backported this to 2.2. In 2.3, this code remains in severe need of refactoring.
* Use __reduce_ex__.Guido van Rossum2003-02-191-45/+36
|