Commit graph

219 commits

Author SHA1 Message Date
Christian Heimes
b3d3ee4fef Issue #17810: Add NULL check to save_frozenset
CID 1131949:  Dereference null return value  (NULL_RETURNS)
2013-11-23 21:01:40 +01:00
Antoine Pitrou
c9dc4a2a8a Issue #17810: Implement PEP 3154, pickle protocol 4.
Most of the work is by Alexandre.
2013-11-23 18:59:12 +01:00
Victor Stinner
804e05e800 Issue #19437: Use an identifier for "__name__" string in pickle to improve
error handling

The following code didn't handle correctly the failure of
PyUnicode_InternFromString("__name__").

if (newobj_str == NULL) {
    newobj_str = PyUnicode_InternFromString("__newobj__");
    name_str = PyUnicode_InternFromString("__name__");
    if (newobj_str == NULL || name_str == NULL)
        return -1;
}
2013-11-14 01:26:17 +01:00
Victor Stinner
bb52020d44 Issue #19512: pickle now uses an identifier to only create the Unicode string
"modules" once
2013-11-06 22:40:41 +01:00
Victor Stinner
2ae57e3cf8 Issue #19437: Fix _pickle, don't call _Unpickler_SkipConsumed() with an
exception set
2013-10-31 13:39:23 +01:00
Victor Stinner
b43ad1d569 cleanup _Unpickler_SkipConsumed(): remove 1 level of indentation 2013-10-31 13:38:42 +01:00
Serhiy Storchaka
46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka
9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Christian Heimes
f446d21708 Issue #18559: Fix NULL pointer dereference error in _pickle module 2013-07-26 22:45:47 +02:00
Christian Heimes
9ee5c37c8f Issue #18559: Fix NULL pointer dereference error in _pickle module 2013-07-26 22:45:00 +02:00
Victor Stinner
1e53bbaced Issue #18408: handle PySys_GetObject() failure, raise a RuntimeError 2013-07-16 22:26:05 +02:00
Victor Stinner
4202456cd4 Issue #18408: _pickle.c: Add missing PyErr_NoMemory() on memory allocation failures 2013-07-12 00:53:57 +02:00
Victor Stinner
8ca72e2e3d Issue #18408: _PyMemoTable_ResizeTable() now restores the old table if
allocating a bigger table failed

PyMemoTable destructor does crash if mt_table is NULL.
2013-07-12 00:53:26 +02:00
Victor Stinner
c31df04234 Issue #18408: Oh, I was wrong: Pickler_New() must call Py_DECREF() to destroy
the newly created pickler, and not PyObject_GC_Del().
2013-07-12 00:08:59 +02:00
Victor Stinner
68c8ea25f1 Issue #18408: Fix _Pickler_New() and _Unpickler_New(): initialize all
attributes before handling errors

_Pickler_New() now calls PyObject_GC_Del() instead of Py_DECREF() on error,
because the pickle object is created using PyObject_GC_New().

Fix a crash in the destructor when an attribute is not initiallized.
2013-07-11 22:56:25 +02:00
Victor Stinner
49fc8ece81 Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
2013-07-07 23:30:24 +02:00
Christian Heimes
54882bfc18 Singular form just like the other error message. 2013-07-01 15:23:48 +02:00
Christian Heimes
8087879349 Singular form just like the other error message. 2013-07-01 15:23:39 +02:00
Christian Heimes
bfafab1849 Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a
segfault inside the _pickle C extension.
2013-07-01 15:18:49 +02:00
Christian Heimes
a24b4d260b Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a
segfault inside the _pickle C extension.
2013-07-01 15:17:45 +02:00
Christian Heimes
82e6b94b95 Fix resource leak in pickle module
CID 983309 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable unicode_str going out of scope leaks the storage it points to.
2013-06-29 21:37:34 +02:00
Alexandre Vassalotti
4fe2184a0f Merge 3.3 2013-04-20 21:28:49 -07:00
Alexandre Vassalotti
637c7c475a Fix reference leak in _pickle. 2013-04-20 21:28:21 -07:00
Alexandre Vassalotti
7c5e094cbf Make C and Python implementations of pickle load STRING opcodes the same way.
The C version tried to remove trailing whitespace between the last quote and
the newline character. I am not sure why it had this because pickle never
generated such pickles---for this to happen repr(some_string) would need to
return trailing whitespace. It was maybe there to make it easier for people
to write pickles in text editors. Anyhow, the Python version doesn't do this
so there is no point keeping this around anymore.

Also, I've changed the exception raised when a bad pickle is encountered.
Again this unlikely to make much difference to anyone though it does make
testing slightly nicer for us.
2013-04-15 23:14:55 -07:00
Antoine Pitrou
af94051a93 Issue #17710: Fix pickle raising a SystemError on bogus input. 2013-04-15 21:55:14 +02:00
Antoine Pitrou
3034efdd29 Issue #17710: Fix pickle raising a SystemError on bogus input. 2013-04-15 21:51:09 +02:00
Alexandre Vassalotti
cc7571727f Style cleanups for pickle.py and _pickle. 2013-04-14 02:25:10 -07:00
Alexandre Vassalotti
6d9e14593e Merge 3.3 2013-04-14 02:11:16 -07:00
Alexandre Vassalotti
00d83f2d05 Clean up error messages raised by save_reduce in _pickle. 2013-04-14 01:28:01 -07:00
Antoine Pitrou
4b7b0f06b4 gibibytes (Arfrever) 2013-04-07 23:46:52 +02:00
Antoine Pitrou
299978dfe3 Issue #15596: Faster pickling of unicode strings. 2013-04-07 17:38:11 +02:00
Serhiy Storchaka
f8def28ff0 Issue #17193: Use binary prefixes (KiB, MiB, GiB) for memory units. 2013-02-16 17:29:56 +02:00
Antoine Pitrou
9982c53c2f Issue #12848: The pure Python pickle implementation now treats object lengths as unsigned 32-bit integers, like the C implementation does.
Patch by Serhiy Storchaka.
2012-11-24 20:41:34 +01:00
Antoine Pitrou
bf6ecf92fa Issue #12848: The pure Python pickle implementation now treats object lengths as unsigned 32-bit integers, like the C implementation does.
Patch by Serhiy Storchaka.
2012-11-24 20:40:21 +01:00
Benjamin Peterson
e80b29b5b6 cleanup Ellipsis and NotImplemented strings after we're done 2012-03-16 18:45:31 -05:00
Łukasz Langa
cad1a07bec minor PEP7-related fix 2012-03-12 23:41:07 +01:00
Łukasz Langa
dbd7825d56 #13842: check whether PyUnicode_FromString succeeded 2012-03-12 22:59:11 +01:00
Łukasz Langa
f3078fbee2 Fixes #13842: cannot pickle Ellipsis or NotImplemented.
Thanks for James Sanders for the bug report and the patch.
2012-03-12 19:46:12 +01:00
Antoine Pitrou
8d3c290de4 Issue #14166: Pickler objects now have an optional dispatch_table attribute which allows to set custom per-pickler reduction functions.
Patch by sbt.
2012-03-04 18:31:48 +01:00
Alexandre Vassalotti
a23d65ccfe Merge 3.2 2011-12-13 13:22:42 -05:00
Alexandre Vassalotti
3bfc65a25b Issue #13505: Make pickling of bytes object compatible with Python 2.
Initial patch by sbt.
2011-12-13 13:08:09 -05:00
Victor Stinner
13f0c6166f _pickle: Fix load_counted_tuple(), use Py_ssize_t for size
Fix a warning on Windows 64-bit.
2016-03-14 18:09:39 +01:00
Martin v. Löwis
1c67dd9b15 Port SetAttrString/HasAttrString to SetAttrId/GetAttrId. 2011-10-14 15:16:45 +02:00
Martin v. Löwis
bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Victor Stinner
f5cff56a1b Issue #13088: Add shared Py_hexdigits constant to format a number into base 16 2011-10-14 02:13:11 +02:00
Martin v. Löwis
1ee1b6fe0d Use identifier API for PyObject_GetAttrString. 2011-10-10 18:11:30 +02:00
Martin v. Löwis
afe55bba33 Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Antoine Pitrou
5a688dbf97 Issue #7689: Allow pickling of dynamically created classes when their
metaclass is registered with copyreg.  Patch by Nicolas M. Thiéry and
Craig Citro.
2011-10-04 09:25:28 +02:00
Antoine Pitrou
ffd41d9f10 Issue #7689: Allow pickling of dynamically created classes when their
metaclass is registered with copyreg.  Patch by Nicolas M. Thiéry and
Craig Citro.
2011-10-04 09:23:04 +02:00
Victor Stinner
c806fdcd8b raw_unicode_escape() uses the new Unicode API 2011-09-29 23:50:23 +02:00