Serhiy Storchaka
59fb6342a4
Issue #25761 : Improved detecting errors in broken pickle data.
2015-12-06 22:01:35 +02:00
Serhiy Storchaka
fbc3e374a6
Fixed reference leak when read truncated pickle.
2015-12-01 00:20:49 +02:00
Serhiy Storchaka
77a61d292a
Fixed reference leak when read truncated pickle.
2015-12-01 00:20:36 +02:00
Serhiy Storchaka
ca28eba3d3
Fixed reference leak when read truncated pickle.
2015-12-01 00:18:23 +02:00
Serhiy Storchaka
14128d8bc5
Issue #25725 : Fixed a reference leak in pickle.loads() when unpickling
...
invalid data including tuple instructions.
2015-11-25 15:07:36 +02:00
Serhiy Storchaka
c5f3b4285a
Issue #25725 : Fixed a reference leak in pickle.loads() when unpickling
...
invalid data including tuple instructions.
2015-11-25 15:06:49 +02:00
Serhiy Storchaka
a49de6be36
Issue #25725 : Fixed a reference leak in pickle.loads() when unpickling
...
invalid data including tuple instructions.
2015-11-25 15:01:53 +02:00
Serhiy Storchaka
b1ce30281d
Issue #23914 : Fixed SystemError raised by unpickler on broken pickle data.
2015-11-23 15:20:21 +02:00
Serhiy Storchaka
4409c6cfae
Issue #23914 : Fixed SystemError raised by unpickler on broken pickle data.
2015-11-23 15:19:23 +02:00
Serhiy Storchaka
e9b3074cf9
Issue #23914 : Fixed SystemError raised by unpickler on broken pickle data.
2015-11-23 15:17:43 +02:00
Victor Stinner
9ba97df69c
Closes #25645 : Fix a reference leak introduced by change bc5894a3a0e6 of the
...
issue #24164 .
2015-11-17 12:15:07 +01:00
Serhiy Storchaka
fad85aadb0
Issue #25558 : Use compile-time asserts.
2015-11-07 15:42:38 +02:00
Martin Panter
e56a919100
Issue #25523 : Merge a-to-an corrections from 3.5
2015-11-02 04:27:17 +00:00
Martin Panter
2eb819f7a8
Issue #25523 : Merge "a" to "an" fixes from 3.4 into 3.5
2015-11-02 04:04:57 +00:00
Martin Panter
7462b64911
Issue #25523 : Correct "a" article to "an" article
...
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Victor Stinner
358af13526
Issue #25353 : Optimize unicode escape and raw unicode escape encoders to use
...
the new _PyBytesWriter API.
2015-10-12 22:36:57 +02:00
Serhiy Storchaka
0d554d7ef1
Issue #24164 : Objects that need calling ``__new__`` with keyword arguments,
...
can now be pickled using pickle protocols older than protocol version 4.
2015-10-10 22:42:18 +03:00
Serhiy Storchaka
525faaeffc
Issue #25262 . Added support for BINBYTES8 opcode in Python implementation of
...
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
2015-09-29 22:12:29 +03:00
Serhiy Storchaka
e060619d4b
Issue #25262 . Added support for BINBYTES8 opcode in Python implementation of
...
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
2015-09-29 22:10:07 +03:00
Benjamin Peterson
bdb93c3e63
merge 3.4 ( #25245 )
2015-09-27 01:16:12 -07:00
Benjamin Peterson
6aa1564e9c
initialize return value to NULL to avoid compiler compliants ( closes #25245 )
2015-09-27 01:16:03 -07:00
Benjamin Peterson
03c59b9bef
merge 3.4
2015-09-26 00:09:32 -07:00
Benjamin Peterson
e48cf7e729
prevent overflow in _Unpickler_Read
2015-09-26 00:08:34 -07:00
Yury Selivanov
f488fb422a
Issue #19235 : Add new RecursionError exception. Patch by Georg Brandl.
2015-07-03 01:04:23 -04:00
Benjamin Peterson
42e913aa3a
merge 3.4 ( #24552 )
2015-07-02 16:18:58 -05:00
Benjamin Peterson
80f78a3efc
fix use after free ( closes #24552 )
2015-07-02 16:18:38 -05:00
Benjamin Peterson
7763c68dcd
merge 3.4
2015-06-27 14:18:23 -05:00
Benjamin Peterson
ff0f322edb
merge 3.3
2015-06-27 13:56:46 -05:00
Benjamin Peterson
59b08c18a8
use safe allocation and reallocation macros
2015-06-27 13:41:33 -05:00
Larry Hastings
89964c48d1
Issue #23944 : Argument Clinic now wraps long impl prototypes at column 78.
2015-04-14 18:07:59 -04:00
Serhiy Storchaka
1009bf18b3
Issue #23501 : Argumen Clinic now generates code into separate files by default.
2015-04-03 23:53:51 +03:00
Serhiy Storchaka
58e4134a1c
Issue #23611 : Serializing more "lookupable" objects (such as unbound methods
...
or nested classes) now are supported with pickle protocols < 4.
2015-03-31 14:07:24 +03:00
Serhiy Storchaka
d5d818d40b
Issue #18473 : Fixed 2to3 and 3to2 compatible pickle mappings.
...
Fixed ambigious reverse mappings. Added many new mappings. Import mapping
is no longer applied to modules already mapped with full name mapping.
Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
2015-03-31 13:17:10 +03:00
Serhiy Storchaka
bfe1824d08
Issue #18473 : Fixed 2to3 and 3to2 compatible pickle mappings.
...
Fixed ambigious reverse mappings. Added many new mappings. Import mapping
is no longer applied to modules already mapped with full name mapping.
Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
2015-03-31 13:12:37 +03:00
Serhiy Storchaka
c86ca26d32
Issue #23096 : Pickle representation of floats with protocol 0 now is the same
...
for both Python and C implementations.
2015-02-15 14:18:32 +02:00
Serhiy Storchaka
707b5ccde5
Issue #22783 : Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX
...
opcode if possible.
2014-12-16 19:43:46 +02:00
Serhiy Storchaka
01bdd9a980
Issue #15513 : Added a __sizeof__ implementation for pickle classes.
2014-12-16 19:40:58 +02:00
Serhiy Storchaka
5bbd231f27
Issue #15513 : Added a __sizeof__ implementation for pickle classes.
2014-12-16 19:39:08 +02:00
Antoine Pitrou
6cd5eda0dd
Fix uninitialized variable after #22676 .
2014-12-02 00:20:03 +01:00
Antoine Pitrou
fce60eaf15
Issue #22676 : Make the pickling of global objects which don't have a __module__ attribute less slow.
2014-10-23 22:47:50 +02:00
Serhiy Storchaka
67c719b34b
Silenced some warnings about comparison between signed and unsigned integer
...
expressions.
2014-09-05 10:10:23 +03:00
Victor Stinner
049e509a9f
Issue #22207 : Fix "comparison between signed and unsigned integers" warning in
...
test checking for integer overflow on Py_ssize_t type: cast explicitly to
size_t.
2014-08-17 22:20:00 +02:00
Victor Stinner
7270b7f1aa
_pickle: Optimize raw_unicode_escape(), use directly a bytes object, don't use
...
a temporary bytearray object.
2014-08-17 21:14:46 +02:00
Victor Stinner
f13c46cc69
Issue #22218 : Fix "comparison between signed and unsigned integers" warnings in
...
Modules/_pickle.c.
2014-08-17 21:05:55 +02:00
Larry Hastings
581ee3618c
Issue #20326 : Argument Clinic now uses a simple, unique signature to
...
annotate text signatures in docstrings, resulting in fewer false
positives. "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.
Issue #20326 : Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
2014-01-28 05:00:08 -08:00
Serhiy Storchaka
3c1f0f1b42
Issue #20395 : Extract generated clinic code in Modules/_pickle.c to separate file.
2014-01-27 10:34:22 +02:00
Christian Heimes
27ea78b352
silence compiler warning that 's' may be used uninitialized in the load function.
2014-01-27 01:03:53 +01:00
Larry Hastings
c20472640c
Issue #20390 : Small fixes and improvements for Argument Clinic.
2014-01-25 20:43:29 -08:00
Larry Hastings
5c66189e88
Issue #20189 : Four additional builtin types (PyTypeObject,
...
PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type)
have been modified to provide introspection information for builtins.
Also: many additional Lib, test suite, and Argument Clinic fixes.
2014-01-24 06:17:25 -08:00
Larry Hastings
462582651c
Two minor Argument Clinic bugfixes: use the name of the class in the
...
docstring for __new__ and __init__, and always use "goto exit" instead of
returning "NULL" for failure to parse (as _new__ and __init__ return ints).
2014-01-22 03:05:49 -08:00
Larry Hastings
b7ccb20423
Issue #20294 : Argument Clinic now supports argument parsing for __new__ and
...
__init__ functions.
2014-01-18 23:50:21 -08:00
Larry Hastings
bebf73511a
Issue #20287 : Argument Clinic's output is now configurable, allowing
...
delaying its output or even redirecting it to a separate file.
2014-01-17 17:47:17 -08:00
Larry Hastings
8666e65206
Issue #20228 : Argument Clinic now has special support for class special
...
methods.
2014-01-12 14:12:59 -08:00
Larry Hastings
61272b77b0
Issue #19273 : The marker comments Argument Clinic uses have been changed
...
to improve readability.
2014-01-07 12:41:53 -08:00
Larry Hastings
3cceb38486
Issue #19976 : Argument Clinic METH_NOARGS functions now always
...
take two parameters.
2014-01-04 11:09:09 -08:00
Stefan Krah
f483b0f3a9
Issue #19972 : Add rarely used freefunc. This fixes a leak if sys.exit()
...
is used in a program.
2013-12-14 13:43:10 +01:00
Alexandre Vassalotti
d05c9ff845
Issue #6784 : Strings from Python 2 can now be unpickled as bytes objects.
...
Initial patch by Merlijn van Deen.
I've added a few unrelated docstring fixes in the patch while I was at
it, which makes the documentation for pickle a bit more consistent.
2013-12-07 01:09:27 -08:00
Alexandre Vassalotti
6e73ff1a31
Issue #19881 : Fix bad pickling of large bytes in cpickle.
2013-12-05 19:29:32 -08:00
Alexandre Vassalotti
2ccf8e969c
Issue #6477 : Merge with 3.3.
2013-11-30 17:58:53 -08:00
Alexandre Vassalotti
65846c6c51
Issue #6477 : Keep PyNotImplemented_Type and PyNone_Type private.
2013-11-30 17:55:48 -08:00
Alexandre Vassalotti
3c23e7a5dc
Issue #6477 : Merge with 3.3.
2013-11-30 16:21:20 -08:00
Alexandre Vassalotti
19b6fa6ebb
Issue #6477 : Added support for pickling the types of built-in singletons.
2013-11-30 16:06:39 -08:00
Alexandre Vassalotti
a1eedf9ff0
Merge with 3.3.
2013-11-30 13:55:39 -08:00
Alexandre Vassalotti
896414fedf
Fixed _pickle.Unpickler to handle empty persistent IDs correctly.
2013-11-30 13:52:35 -08:00
Serhiy Storchaka
6fe39b76a9
Issue #17897 : Optimized unpickle prefetching.
2013-11-30 23:15:38 +02:00
Alexandre Vassalotti
567eba1852
Use PyDict_GetItemWithError instead of PyDict_GetItem in cpickle.
2013-11-28 17:09:16 -08:00
Alexandre Vassalotti
6bf41e54a4
Remove explicit empty tuple reuse in cpickle.
...
PyTuple_New(0) always returns the same empty tuple from its free list anyway,
so we are not saving much here. Plus, the code where this was used is on
uncommon run paths.
2013-11-28 15:17:29 -08:00
Alexandre Vassalotti
b13e6bcbd8
Remove the tuple reuse optimization in _Pickle_FastCall.
...
I have noticed a race-condition occurring on one of the buildbots because of
this optimization. The function called may release the GIL which means
multiple threads may end up accessing the shared tuple. I could fix it up by
storing the tuple to the Pickler and Unipickler object again, but honestly it
really not worth the trouble.
I ran many benchmarks and the only time the optimization helps is when using a
fin-memory file, like io.BytesIO on which reads are super cheap, combined with
pickle protocol less than 4. Even in this contrived case, the speedup is a
about 5%. For everything else, this optimization does not provide any
noticable improvements.
2013-11-28 14:56:09 -08:00
Alexandre Vassalotti
23bdd83053
Encapsulate cpickle global state in a dedicated object.
...
This implements PEP 3121 module finalization as well. This change does not
cause any significant impact on performance.
2013-11-27 19:36:52 -08:00
Alexandre Vassalotti
20c28c1ea2
Combine the FastCall functions in cpickle.
...
I fixed the bug that was in my previous attempt of this cleanup. I ran
the full test suite to verify I didn't introduce any obvious bugs.
2013-11-27 02:26:54 -08:00
Alexandre Vassalotti
b4a04fb7e6
Reverting e39db21df580 eagerly due to buildbot failures.
2013-11-25 13:25:12 -08:00
Alexandre Vassalotti
f94a041f8f
Combine _Pickler_FastCall and _Unpickler_FastCall in cpickle.
2013-11-25 13:03:32 -08:00
Alexandre Vassalotti
1048fb5539
Issue #19739 : Try to fix compiler warnings on 32-bit Windows.
2013-11-25 11:35:46 -08:00
Alexandre Vassalotti
ded929b300
Merge save_int into save_long in cpickle to remove redundant code.
...
Also, replace unnessary uses of the #if preprocessor directive.
2013-11-24 22:41:13 -08:00
Alexandre Vassalotti
8a67f52463
Simplify save_bool in cpickle.
2013-11-24 21:40:18 -08:00
Alexandre Vassalotti
ed8c906127
Use Clinic to process arguments in cpickle.
...
This doesn't make any functional changes to the exisiting implementation. The
conversion did help however uncover documentation bugs. The best thing about
this conversion is less C code to maintain by hand.
2013-11-24 12:25:48 -08:00
Alexandre Vassalotti
fc91285c93
Remove code path in cpickle that does not exist in pickle.
2013-11-24 03:07:35 -08:00
Alexandre Vassalotti
c49477b184
Make Ellipsis and NotImplemented picklable through the reduce protocol.
2013-11-24 02:53:45 -08:00
Alexandre Vassalotti
4c05d3bc56
Make built-in methods picklable through the reduce protocol.
2013-11-24 02:41:05 -08:00
Alexandre Vassalotti
b6a2f2a0d1
Make framing optional in pickle protocol 4.
...
This will allow us to control in the future whether to use framing or not.
For example, we may want to turn it off for tiny pickle where it doesn't
help.
The change also improves performance slightly:
### fastpickle ###
Min: 0.608517 -> 0.557358: 1.09x faster
Avg: 0.798892 -> 0.694738: 1.15x faster
Significant (t=3.45)
Stddev: 0.17145 -> 0.12704: 1.3496x smaller
Timeline: http://goo.gl/3xQE1J
### pickle_dict ###
Min: 0.669920 -> 0.615271: 1.09x faster
Avg: 0.733633 -> 0.645058: 1.14x faster
Significant (t=5.05)
Stddev: 0.12041 -> 0.02961: 4.0662x smaller
Timeline: http://goo.gl/LpLSXI
### pickle_list ###
Min: 0.397583 -> 0.368112: 1.08x faster
Avg: 0.412784 -> 0.397223: 1.04x faster
Significant (t=2.78)
Stddev: 0.01518 -> 0.03653: 2.4068x larger
Timeline: http://goo.gl/v39E59
### unpickle_list ###
Min: 0.692935 -> 0.594870: 1.16x faster
Avg: 0.730012 -> 0.628395: 1.16x faster
Significant (t=17.76)
Stddev: 0.02720 -> 0.02995: 1.1012x larger
Timeline: http://goo.gl/2P9AEt
The following not significant results are hidden, use -v to show them:
fastunpickle.
2013-11-23 20:30:03 -08:00
Antoine Pitrou
c1207c1bcf
Fix signed / unsigned comparison
2013-11-23 21:34:04 +01:00
Gregory P. Smith
2b38fc187c
gcc doesn't realize that dummy is always initialized by the function call
...
and warns about potential uninitialized use.
Silence that by initializing it to null.
2013-11-23 20:21:28 +00:00
Christian Heimes
e8b1ba1699
Issue #17810 : Add two missing error checks to save_global
...
CID 1131946: Unchecked return value (CHECKED_RETURN)
2013-11-23 21:13:39 +01:00
Antoine Pitrou
6188d09f1c
Merge
2013-11-23 21:06:21 +01:00
Christian Heimes
74d8d63b18
Issue #17810 : return -1 on error
2013-11-23 21:05:31 +01:00
Antoine Pitrou
8f2ee6e407
Fix writing out 64-bit size fields on 32-bit builds
2013-11-23 21:05:08 +01:00
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
Victor Stinner
121aab4ba1
Strip trailing spaces of _pickle.c
2011-09-29 23:40:53 +02:00
Martin v. Löwis
d63a3b8beb
Implement PEP 393.
2011-09-28 07:41:54 +02:00
Benjamin Peterson
3454d52434
merge 3.2
2011-09-23 13:53:06 -04:00
Benjamin Peterson
adde86d0e3
fix compiler compliant about \0 not being an opcode
2011-09-23 13:41:41 -04:00
Antoine Pitrou
a514eb95f3
Issue #12847 : Fix a crash with negative PUT and LONG_BINPUT arguments in
...
the C pickle implementation.
2011-08-30 00:28:40 +02:00
Antoine Pitrou
55549ec476
Issue #12847 : Fix a crash with negative PUT and LONG_BINPUT arguments in
...
the C pickle implementation.
2011-08-30 00:27:10 +02:00
Antoine Pitrou
ee763e2acc
Issue #11564 : Avoid crashes when trying to pickle huge objects or containers
...
(more than 2**31 items). Instead, in most cases, an OverflowError is raised.
2011-08-29 23:14:53 +02:00
Antoine Pitrou
82be19f889
Issue #11564 : Avoid crashes when trying to pickle huge objects or containers
...
(more than 2**31 items). Instead, in most cases, an OverflowError is raised.
2011-08-29 23:09:33 +02:00
Antoine Pitrou
e58bffb8ae
Followup to 8e824e09924a: fix regression on 32-bit builds
2011-08-13 20:40:32 +02:00
Antoine Pitrou
3c7e928098
Issue #12744 : Fix inefficient representation of integers
...
between 2**31 and 2**63 on systems with a 64-bit C "long".
2011-08-13 20:15:19 +02:00
Antoine Pitrou
fdf4a27422
Issue #12687 : Fix a possible buffering bug when unpickling text mode (protocol 0, mostly) pickles.
2011-08-11 21:15:53 +02:00
Antoine Pitrou
f6c7a8595e
Issue #12687 : Fix a possible buffering bug when unpickling text mode (protocol 0, mostly) pickles.
2011-08-11 21:04:02 +02:00
Antoine Pitrou
874d65afae
Issue #11321 : Fix a crash with multiple imports of the _pickle module when
...
embedding Python. Patch by Andreas Stührk.
2011-07-15 21:02:09 +02:00
Antoine Pitrou
8391cf4e1d
Issue #11321 : Fix a crash with multiple imports of the _pickle module when
...
embedding Python. Patch by Andreas Stührk.
2011-07-15 21:01:21 +02:00
Ezio Melotti
3b3499ba69
#11565 : Merge with 3.1.
2011-03-16 11:35:38 +02:00
Ezio Melotti
13925008dc
#11565 : Fix several typos. Patch by Piotr Kasprzyk.
2011-03-16 11:05:33 +02:00
Ezio Melotti
b88ed1549e
#11565 : Merge with 3.2.
2011-03-16 11:38:59 +02:00
Antoine Pitrou
16c4ce1903
Issue #9935 : Speed up pickling of instances of user-defined classes.
2011-03-11 21:30:43 +01:00
Alexander Belopolsky
ec8f0df229
Merged revisions 88546 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88546 | alexander.belopolsky | 2011-02-24 14:40:09 -0500 (Thu, 24 Feb 2011) | 3 lines
Issue #11286 : Fixed unpickling of empty 2.x strings.
........
2011-02-24 20:34:38 +00:00
Alexander Belopolsky
1ce92dc20d
Issue #11286 : Fixed unpickling of empty 2.x strings.
2011-02-24 19:40:09 +00:00
Antoine Pitrou
0f2a61a11e
Merged revisions 88147 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88147 | antoine.pitrou | 2011-01-23 18:12:25 +0100 (dim., 23 janv. 2011) | 3 lines
Issue #10987 : Fix the recursion limit handling in the _pickle module.
........
2011-01-23 17:21:28 +00:00
Antoine Pitrou
e6d4c5bab8
Issue #10987 : Fix the recursion limit handling in the _pickle module.
2011-01-23 17:12:25 +00:00
Victor Stinner
132ef6cca3
Issue #10359 : Remove useless comma, invalid in ISO C
2010-11-09 09:39:41 +00:00
Antoine Pitrou
ff150f2921
Revert r85797 (and r85798): it broke the Windows buildbots because of
...
test_multiprocessing's misbehaviour.
2010-10-22 21:41:05 +00:00
Antoine Pitrou
7eecffd05d
Issue #9935 : Speed up pickling of instances of user-defined classes.
2010-10-22 19:43:59 +00:00
Georg Brandl
f038b32d0b
Remove more unneeded casts to hashfunc.
2010-10-18 07:35:09 +00:00
Benjamin Peterson
8f67d0893f
make hashes always the size of pointers; introduce Py_hash_t #9778
2010-10-17 20:54:53 +00:00
Antoine Pitrou
04248a8d99
Issue #3873 : Speed up unpickling from file objects which have a peek()
...
method.
2010-10-12 20:51:21 +00:00
Antoine Pitrou
ea99c5c949
Issue #9410 : Various optimizations to the pickle module, leading to
...
speedups up to 4x (depending on the benchmark). Mostly ported from
Unladen Swallow; initial patch by Alexandre Vassalotti.
2010-09-09 18:33:21 +00:00
Antoine Pitrou
ec80478967
Merged revisions 84502 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84502 | antoine.pitrou | 2010-09-04 20:45:37 +0200 (sam., 04 sept. 2010) | 3 lines
Fix typos in error messages (thanks Arfrever).
........
2010-09-04 18:46:56 +00:00
Antoine Pitrou
1afb39a437
Fix typos in error messages (thanks Arfrever).
2010-09-04 18:45:37 +00:00
Alexander Belopolsky
82a6bf049e
Merged revisions 82937 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r82937 | alexander.belopolsky | 2010-07-17 18:50:45 -0400 (Sat, 17 Jul 2010) | 3 lines
Issue #5180 : Fixed a bug that prevented loading 2.x pickles in 3.x
python when they contain instances of old-style classes.
........
2010-07-17 23:01:39 +00:00
Alexander Belopolsky
d92f04062a
Issue #5180 : Fixed a bug that prevented loading 2.x pickles in 3.x
...
python when they contain instances of old-style classes.
2010-07-17 22:50:45 +00:00
Victor Stinner
f7351b40b5
Merged revisions 80031 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r80031 | victor.stinner | 2010-04-13 13:07:24 +0200 (mar., 13 avril 2010) | 4 lines
Issue #8383 : pickle and pickletools use surrogatepass error handler when
encoding unicode as utf8 to support lone surrogates and stay compatible with
Python 2.x and 3.0
........
2010-04-13 11:09:22 +00:00
Victor Stinner
485fb56eb8
Issue #8383 : pickle and pickletools use surrogatepass error handler when
...
encoding unicode as utf8 to support lone surrogates and stay compatible with
Python 2.x and 3.0
2010-04-13 11:07:24 +00:00
Antoine Pitrou
901d81e672
Merged revisions 77355 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r77355 | antoine.pitrou | 2010-01-07 18:57:31 +0100 (jeu., 07 janv. 2010) | 18 lines
Merged revisions 77352-77354 via svnmerge from
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!
........
................
2010-01-07 18:02:53 +00:00
Antoine Pitrou
01a15ea2b6
Merged revisions 77352-77354 via svnmerge from
...
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!
........
2010-01-07 17:57:31 +00:00
Antoine Pitrou
d9dfaa9487
Issue #6137 : The pickle module now translates module names when loading
...
or dumping pickles with a 2.x-compatible protocol, in order to make data
sharing and migration easier. This behaviour can be disabled using the
new `fix_imports` optional argument.
2009-06-04 20:32:06 +00:00
Collin Winter
8ca69de237
Merged revisions 72930 via svnmerge from
...
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.
........
2009-05-26 16:53:41 +00:00
Alexandre Vassalotti
f70b129d7c
Make variable declarations for opcodes in batch_dict_exact consistent
...
with the rest of the module.
2009-05-25 18:00:52 +00:00
Collin Winter
5c9b02dffe
Merged revisions 72909 via svnmerge from
...
http://svn.python.org/projects/python/trunk
Note that the performance improvement for the py3k branch is not as high as for trunk.
........
r72909 | collin.winter | 2009-05-24 21:34:39 -0700 (Sun, 24 May 2009) | 2 lines
Issue 5670: special-case pickling of dicts. This nearly doubles the performance of dict pickling in cPickle.
........
2009-05-25 05:43:30 +00:00
Mark Dickinson
725bfd8489
Issue #5914 : Add new C-API function PyOS_string_to_double, to complement
...
PyOS_double_to_string, and deprecate PyOS_ascii_strtod and PyOS_ascii_atof.
2009-05-03 20:33:40 +00:00
Antoine Pitrou
a9f48a0d4f
Merged revisions 72223 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72223 | antoine.pitrou | 2009-05-02 23:13:23 +0200 (sam., 02 mai 2009) | 5 lines
Isue #5084 : unpickling now interns the attribute names of pickled objects,
saving memory and avoiding growth in size of subsequent pickles. Proposal
and original patch by Jake McGuire.
........
2009-05-02 21:41:14 +00:00
Mark Dickinson
3e09f43e06
Make sure that marshal and pickle continue to output 17
...
digits of precision for floats.
2009-04-17 08:41:23 +00:00
Eric Smith
0923d1d8d7
The other half of Issue #1580 : use short float repr where possible.
...
Addresses the float -> string conversion, using David Gay's code which
was added in Mark Dickinson's checkin r71663.
Also addresses these, which are intertwined with the short repr
changes:
- Issue #5772 : format(1e100, '<') produces '1e+100', not '1.0e+100'
- Issue #5515 : 'n' formatting with commas no longer works poorly
with leading zeros.
- PEP 378 Format Specifier for Thousands Separator: implemented
for floats.
2009-04-16 20:16:10 +00:00
Alexandre Vassalotti
0e7aa8c13c
Update a comment about why the __module__ can sometime be NULL.
...
Initialize last_string and arg member of Unpickler.
2009-04-03 04:17:41 +00:00
Mark Dickinson
e94c679df0
Issue #1717 : rename tp_compare to tp_reserved. I'll change the
...
type of tp_compare in a separate commit, for ease of reversion
should things go wrong.
2009-02-02 20:36:42 +00:00
Mark Dickinson
211c625829
Issue #1717 , stage 2: remove uses of tp_compare in Modules and most
...
Objects.
2009-02-01 10:28:51 +00:00
Mark Dickinson
cddcf444b2
Merged revisions 68903,68906 via svnmerge from
...
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.
........
2009-01-24 21:46:33 +00:00
Alexandre Vassalotti
e4bccb7146
Factor common branch in load_long().
...
Suggested by Neal Norwitz.
2009-01-24 01:47:57 +00:00
Alexandre Vassalotti
446f7ffa0f
Remove unnecessary copying in load_long().
2009-01-23 04:43:46 +00:00
Mark Dickinson
8dd05147d6
Issue #4842 , patch 1/2: fix pickle in Python 3.x so that pickling with the
...
'L' opcode always appends an 'L' on output, just as 2.x does. When
unpickling, remove the trailing 'L' (if present) before passing the
result to PyLong_FromString.
2009-01-20 20:43:58 +00:00
Alexandre Vassalotti
554d878b1c
Update copy of PyUnicode_EncodeRawUnicodeEscape in _pickle.
...
Add astral character test case.
2008-12-27 07:32:41 +00:00
Amaury Forgeot d'Arc
5f95257ef9
#4373 : Reference leak in the pickle module.
...
Reviewed by Brett Cannon.
2008-11-25 21:11:54 +00:00
Amaury Forgeot d'Arc
3e4e72f66f
#4298 : pickle.load() can segfault on invalid or truncated input.
...
Patch and test by Hirokazu Yamamoto.
2008-11-11 20:05:06 +00:00
Hirokazu Yamamoto
b46a633eaf
Sorry, r67092 is commit miss....
2008-11-04 00:35:10 +00:00
Hirokazu Yamamoto
1543a22d86
Blocked revisions 67002 via svnmerge
...
........
r67002 | hirokazu.yamamoto | 2008-10-23 09:37:33 +0900 | 1 line
Issue #4183 : Some tests didn't run with pickle.HIGHEST_PROTOCOL.
........
2008-11-04 00:31:31 +00:00
Amaury Forgeot d'Arc
424b4819be
Merged revisions 67049 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67049 | amaury.forgeotdarc | 2008-10-30 22:18:34 +0100 (jeu., 30 oct. 2008) | 8 lines
Issue #4176 : Pickle would crash the interpreter when a __reduce__ function
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.
........
2008-10-30 22:25:31 +00:00
Amaury Forgeot d'Arc
87eee631fb
#3664 : The pickle module could segfault if a Pickler instance is not correctly initialized:
...
when a subclass forgets to call the base __init__ method,
or when __init__ is called a second time with invalid parameters
Patch by Alexandre Vassalotti.
2008-10-17 20:15:53 +00:00
Amaury Forgeot d'Arc
fb1a5eb101
#3640 : Correct a crash in cPickle on 64bit platforms, in the case of deeply nested lists or dicts.
...
Reviewed by Martin von Loewis.
2008-09-11 21:03:37 +00:00
Antoine Pitrou
d79dc6216c
Issue #3660 (part of): fix a memory leak in _pickle.
...
Patch by Amaury Forgeot d'Arc, review by me.
2008-09-05 00:03:33 +00:00
Neal Norwitz
6ae2eb268d
Issue #3657 : Fix uninitialized memory read when pickling longs.
...
The conversion to the unicode API was incorrect, it should use bytes.
repr is a bad variable name. The use is overloaded, but I'll leave
that to fix later.
R=Brett
TESTED=./python -E -tt ./Lib/test/regrtest.py -uall
valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
./python -E -tt ./Lib/test/regrtest.py test_pickletools
2008-08-24 23:50:08 +00:00
Alexandre Vassalotti
1f9d907c90
Issue 3514: Fixed segfault dues to infinite loop in __getattr__.
2008-08-15 03:07:47 +00:00
Marc-André Lemburg
4cc0f24857
Rename PyUnicode_AsString -> _PyUnicode_AsString and
...
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark
them for interpreter internal use only.
We'll have to rework these APIs or create new ones for the
purpose of accessing the UTF-8 representation of Unicode objects
for 3.1.
2008-08-07 18:54:33 +00:00