summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-126992: Change pickle code to base 10 for load_long and load_int (GH-127042)Justin Applegate2024-12-111-0/+20
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-126991: Add tests for unpickling bad object state (GH-127031)Serhiy Storchaka2024-11-201-0/+35
| | | This catches a memory leak in loading the BUILD opcode.
* gh-53203: Improve tests for strptime() (GH-125090)Serhiy Storchaka2024-10-081-2/+2
| | | | | | | | | | Run them with different locales and different date and time. Add the @run_with_locales() decorator to run the test with multiple locales. Improve the run_with_locale() context manager/decorator -- it now catches only expected exceptions and reports the test as skipped if no appropriate locale is available.
* Bump Ruff to 0.6.7 (#124384)Alex Waygood2024-09-231-1/+3
|
* gh-77894: Fix a crash when the GC breaks a loop containing a memoryview ↵Serhiy Storchaka2024-09-111-3/+1
| | | | | | | (GH-123898) Now a memoryview object can only be cleared if there are no buffers that refer it.
* gh-122213: Add notes for pickle serialization errors (GH-122214)Serhiy Storchaka2024-09-091-20/+197
| | | | This allows to identify the source of the error.
* Fix typos (#123775)algonell2024-09-091-1/+1
|
* gh-122311: Improve and unify pickle errors (GH-122771)Serhiy Storchaka2024-09-091-108/+105
| | | | | | | | | | | | | * Raise PicklingError instead of UnicodeEncodeError, ValueError and AttributeError in both implementations. * Chain the original exception to the pickle-specific one as __context__. * Include the error message of ImportError and some AttributeError in the PicklingError error message. * Unify error messages between Python and C implementations. * Refer to documented __reduce__ and __newobj__ callables instead of internal methods (e.g. save_reduce()) or pickle opcodes (e.g. NEWOBJ). * Include more details in error messages (what expected, what got). * Avoid including a potentially long repr of an arbitrary object in error messages.
* gh-123431: Harmonize extension code checks in pickle (GH-123434)Serhiy Storchaka2024-08-291-0/+51
| | | | | | | | | This checks are redundant in normal circumstances and can only work if the extension registry was intentionally broken. * The Python implementation now raises exception for the extension code with false boolean value. * Simplify the C code. RuntimeError is now raised in explicit checks. * Add many tests.
* gh-122459: Optimize pickling by name objects without __module__ (GH-122460)Serhiy Storchaka2024-08-051-1/+1
|
* gh-122311: Add more tests for error messages in pickle (GH-122373)Serhiy Storchaka2024-07-291-50/+185
|
* gh-122311: Fix some error messages in pickle (GH-122386)Serhiy Storchaka2024-07-291-1/+3
|
* gh-122311: Add more tests for pickle (GH-122376)Serhiy Storchaka2024-07-281-128/+642
|
* gh-82951: Fix serializing by name in pickle protocols < 4 (GH-122149)Serhiy Storchaka2024-07-251-0/+12
| | | | | | Serializing objects with complex __qualname__ (such as unbound methods and nested classes) by name no longer involves serializing parent objects by value in pickle protocols < 4.
* gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and ↵Bénédikt Tran2024-06-211-6/+43
| | | | `bytearray` objects in protocol version 5. (GH-120422)
* GH-111802: set a low recursion limit for `test_bad_getattr()` in ↵Brett Cannon2024-01-121-1/+1
| | | | `test.pickletester` (GH-113996)
* gh-113028: Correctly memoize str in pickle when escapes added (GH-113436)Jeff Allen2023-12-241-0/+8
| | | | | | This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped.
* gh-82565: Add tests for pickle and unpickle with bad files (GH-16606)Zackery Spytz2023-12-011-0/+78
|
* gh-93627: Align Python implementation of pickle with C implementation of ↵Pieter Eendebak2023-09-101-0/+59
| | | | | pickle (GH-103035) If a method like __reduce_ex_ or __reduce__ is set to None, a TypeError is raised.
* gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421)Serhiy Storchaka2023-09-021-0/+1
| | | | Only mark tests which spend significant system or user time, by itself or in subprocesses.
* gh-100129: Add tests for pickling all builtin types and functions (GH-100142)Serhiy Storchaka2022-12-211-0/+29
|
* gh-95196: Disable incorrect pickling of the C implemented classmethod ↵Serhiy Storchaka2022-10-051-0/+18
| | | | descriptors (GH-96383)
* gh-92930: _pickle.c: Acquire strong references before calling save() (GH-92931)Dennis Sweeney2022-06-111-0/+61
|
* bpo-40280: Detect missing threading on WASM platforms (GH-32352)Christian Heimes2022-04-071-0/+1
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-26579: Add object.__getstate__(). (GH-2821)Serhiy Storchaka2022-04-061-1/+3
| | | | | | | Copying and pickling instances of subclasses of builtin types bytearray, set, frozenset, collections.OrderedDict, collections.deque, weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes implemented as slots.
* bpo-30570: Fix segfault on buildbots caused by stack overflow from recursion ↵Dennis Sweeney2021-10-281-1/+2
| | | | | | | in tests (GH-29258) * Don't stackoveflow on debug builds * Also catch the pickletester case
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-2/+2
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-45229: Make pickle tests discoverable (GH-28467)Serhiy Storchaka2021-09-201-9/+9
|
* bpo-43907: add missing memoize call in pure python pickling of bytearray ↵Carl Friedrich Bolz-Tereick2021-04-231-0/+8
| | | | (GH-25501)
* bpo-42809: Improve pickle tests for recursive data. (GH-24060)Serhiy Storchaka2021-01-021-87/+253
|
* bpo-41052: Fix pickling heap types implemented in C with protocols 0 and 1 ↵Serhiy Storchaka2020-10-241-0/+18
| | | | (GH-22870)
* bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458)Serhiy Storchaka2020-07-131-0/+18
| | | Automerge-Triggered-By: @tiran
* bpo-40275: Use new test.support helper submodules in tests (GH-21314)Hai Shi2020-07-061-5/+8
|
* bpo-41003: Fix test_copyreg when numpy is installed (GH-20935)Victor Stinner2020-06-171-5/+11
| | | | | | | | Fix test_copyreg when numpy is installed: test.pickletester now saves/restores warnings.filters when importing numpy, to ignore filters installed by numpy. Add the save_restore_warnings_filters() function to the test.support.warnings_helper module.
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-271-2/+3
|
* bpo-39681: Fix C pickle regression with minimal file-like objects (#18592)Antoine Pitrou2020-02-231-4/+21
| | | | Fix a regression where the C pickle module wouldn't allow unpickling from a file-like object that doesn't expose a readinto() method.
* bpo-39492: Fix a reference cycle between reducer_override and a Pickler ↵Pierre Glaser2020-02-021-0/+24
| | | | | | | | | | | | instance (GH-18266) This also needs a backport to 3.8 https://bugs.python.org/issue39492 Automerge-Triggered-By: @pitrou
* bpo-38876: Raise pickle.UnpicklingError when loading an item from memo for ↵Claudiu Popa2019-11-241-1/+3
| | | | | | | | | | | | | | | 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
* Don't skip pickle check_frame_opcodes() (GH-15025)Neil Schemenauer2019-07-301-1/+0
| | | | This looks like the only place that proto 4 framing gets exercised so leave it as part of the PGO task.
* bpo-37707: Exclude expensive unit tests from PGO task (GH-15009)Neil Schemenauer2019-07-301-0/+3
| | | | | Mark some individual tests to skip when --pgo is used. The tests marked increase the PGO task time significantly and likely don't help improve optimization of the final executable.
* bpo-37502: handle default parameter for buffers argument of pickle.loads ↵Markus Mohrhard2019-07-251-0/+5
| | | | correctly (GH-14593)
* bpo-31829: Make protocol 0 pickles be loadable in text mode in Python 2. ↵Serhiy Storchaka2019-05-311-4/+15
| | | | | | (GH-11859) Escape ``\r``, ``\0`` and ``\x1a`` (end-of-file on Windows) in Unicode strings.
* bpo-36785: PEP 574 implementation (GH-7076)Antoine Pitrou2019-05-261-12/+411
|
* bpo-35900: Enable custom reduction callback registration in _pickle (GH-12499)Pierre Glaser2019-05-081-0/+68
| | | | Enable custom reduction callback registration for functions and classes in _pickle.c, using the new Pickler's attribute ``reducer_override``.
* bpo-35900: Add a state_setter arg to save_reduce (GH-12588)Pierre Glaser2019-05-081-1/+39
| | | | | 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.
* bpo-36766: Typos in docs and code comments (GH-13116)penguindustin2019-05-061-1/+1
|
* Clean up code which checked presence of os.{stat,lstat,chmod} (#11643)Anthony Sottile2019-02-251-5/+4
|
* bpo-34572: change _pickle unpickling to use import rather than retrieving ↵tjb9002019-02-181-1/+66
| | | | | from sys.modules (GH-9047) Fix C implementation of pickle.loads to use importlib's locking mechanisms, and thereby avoid using partially-loaded modules.
* bpo-33209: End framing at the end of C implementation of ↵Serhiy Storchaka2018-04-031-17/+18
| | | | pickle.Pickler.dump(). (GH-6363)
* bpo-32503: Avoid creating too small frames in pickles. (#5127)Serhiy Storchaka2018-01-201-37/+45
|