| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
pickle (GH-103035)
If a method like __reduce_ex_ or __reduce__ is set to None, a TypeError is raised.
|
| |
|
| |
|
|
|
|
|
| |
copy.copy() and copy.deepcopy() now always raise a TypeError if
__reduce__() returns a tuple with length 6 instead of silently ignore
the 6th item or produce incorrect result.
|
|
|
|
|
| |
Fix typos in the Lib directory as identified by codespell.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
|
|
|
|
| |
(GH-25501)
|
|
|
|
|
|
| |
* bpo-42406: Fix whichmodule() with multiprocessing
Signed-off-by: Renato L. de F. Cunha <renatoc@br.ibm.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
|
|
|
| |
It was positional-only de facto: documentation and two implementations
used three different name.
|
|
|
|
| |
loop (GH-19628)
|
|
|
|
|
|
| |
Some portions of the pickle documentation hadn't been updated for the pickle protocol changes in Python 3.8 (new protocol 5, default protocol 4). This PR fixes those docs.
https://bugs.python.org/issue39426
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
invalid input (GH-17335)
The previous code was raising a `KeyError` for both the Python and C implementation.
This was caused by the specified index of an invalid input which did not exist
in the memo structure, where the pickle stores what objects it has seen.
The malformed input would have caused either a `BINGET` or `LONG_BINGET` load
from the memo, leading to a `KeyError` as the determined index was bogus.
https://bugs.python.org/issue38876
https://bugs.python.org/issue38876
|
|
|
|
|
|
|
| |
Allow pure Python implementation of pickle to work
even when the C _pickle module is unavailable.
Fix test_pickle when _pickle is missing: declare PyPicklerHookTests
outside "if has_c_implementation:" block.
|
|
|
|
|
|
| |
(GH-11859)
Escape ``\r``, ``\0`` and ``\x1a`` (end-of-file on Windows) in Unicode strings.
|
| |
|
|
|
| |
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
|
|
|
|
| |
Enable custom reduction callback registration for functions and classes in
_pickle.c, using the new Pickler's attribute ``reducer_override``.
|
|
|
|
|
| |
Allow reduction methods to return a 6-item tuple where the 6th item specifies a
custom state-setting method that's called instead of the regular
``__setstate__`` method.
|
|
|
|
|
|
|
| |
* When doing getattr lookups with a default of "None", it now
uses an "is" comparison against None which is more correct
* Removed outdated code
Patch by Brandon Rhodes.
|
|
|
| |
This makes performance better and produces shorter pickles. This change is backwards compatible up to the oldest currently supported version of Python (3.4).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The picklers do no longer allocate temporary memory when dumping large
bytes and str objects into a file object. Instead the data is
directly streamed into the underlying file object.
Previously the C implementation would buffer all content and issue a
single call to file.write() at the end of the dump. With protocol 4
this behavior has changed to issue one call to file.write() per frame.
The Python pickler with protocol 4 now dumps each frame content as a
memoryview to an IOBytes instance that is never reused and the
memoryview is no longer released after the call to write. This makes it
possible for the file object to delay access to the memoryview of
previous frames without forcing any additional memory copy as was
already possible with the C pickler.
|
| |
|
|
|
| |
This hides unwanted implementation details from tracebacks.
|
|
|
|
|
| |
method when unpickle collections.deque and other list-like objects.
This can speed up unpickling to 2 times.
|
|\
| |
| |
| | |
Original patch by Alexandre Vassalotti.
|
| |
| |
| |
| | |
Original patch by Alexandre Vassalotti.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
|
| | |
|
|\ \
| |/ |
|
| |\ |
|
| | | |
|
|\ \ \
| |/ / |
|
| |\ \
| | |/ |
|
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|/ /
| |
| |
| | |
can now be pickled using pickle protocols older than protocol version 4.
|
|\ \
| |/
| |
| |
| | |
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
|
| |
| |
| |
| |
| | |
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
|
|/
|
|
| |
or nested classes) now are supported with pickle protocols < 4.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
mutated while iterating.
Patch by Olivier Grisel.
|
| |
|
|
|
|
|
|
|
| |
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.
|
|\ |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
Most of the work is by Alexandre.
|