Commit Graph

74 Commits

Author SHA1 Message Date
Pablo Galindo Salgado ac61d58db0
gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-24 14:08:12 +02:00
Victor Stinner 3e7b7df5cb
gh-114570: Add PythonFinalizationError exception (#115352)
Add PythonFinalizationError exception. This exception derived from
RuntimeError is raised when an operation is blocked during the Python
finalization.

The following functions now raise PythonFinalizationError, instead of
RuntimeError:

* _thread.start_new_thread()
* subprocess.Popen
* os.fork()
* os.fork1()
* os.forkpty()

Morever, _winapi.Overlapped finalizer now logs an unraisable
PythonFinalizationError, instead of an unraisable RuntimeError.
2024-02-14 23:35:06 +01:00
Pablo Galindo Salgado 39d102c2ee
gh-113744: Add a new IncompleteInputError exception to improve incomplete input detection in the codeop module (#113745)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-01-30 16:21:30 +00:00
Brett Cannon f59f90b5bc
GH-114456: lower the recursion limit under WASI for debug builds (GH-114457)
Testing under wasmtime 16.0.0 w/ code from https://github.com/python/cpython/issues/114413 is how the value was found.
2024-01-23 15:48:14 -08:00
Serhiy Storchaka 89cee94b31
gh-89850: Add default C implementations of persistent_id() and persistent_load() (GH-113579)
Previously the C implementation of pickle.Pickler and pickle.Unpickler
classes did not have such methods and they could only be used if
they were overloaded in subclasses or set as instance attributes.

Fixed calling super().persistent_id() and super().persistent_load() in
subclasses of the C implementation of pickle.Pickler and pickle.Unpickler
classes. It no longer causes an infinite recursion.
2024-01-10 15:30:37 +02:00
Erlend E. Aasland c00dcf0e38
gh-103092: Isolate `_pickle` module (#102982)
Co-authored-by: Mohamed Koubaa <koubaa.m@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-04 15:38:54 +05:30
Gregory P. Smith 0ca67e6313
GH-84559: Deprecate fork being the multiprocessing default. (#100618)
This starts the process. Users who don't specify their own start method
and use the default on platforms where it is 'fork' will see a
DeprecationWarning upon multiprocessing.Pool() construction or upon
multiprocessing.Process.start() or concurrent.futures.ProcessPool use.

See the related issue and documentation within this change for details.
2023-02-02 15:50:35 -08:00
Kumar Aditya 01ef1f95da
GH-89988: Fix memory leak in pickle.Pickler dispatch_table lookup (GH-94298) 2022-06-28 10:01:43 +03:00
Irit Katriel f30ad65dbf
bpo-45292: [PEP 654] add the ExceptionGroup and BaseExceptionGroup classes (GH-28569) 2021-10-23 00:13:46 +01:00
Serhiy Storchaka e6ba992288
bpo-45229: Make pickle tests discoverable (GH-28467) 2021-09-20 18:21:33 +03:00
Serhiy Storchaka 36d952d228
bpo-44785: Silence deprecation warnings in test_pickle (#27538) 2021-08-02 18:11:12 +02:00
Inada Naoki 4827483f47
bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)
See [PEP 597](https://www.python.org/dev/peps/pep-0597/).

* Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`.
* Add EncodingWarning
* Add io.text_encoding()
* open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled.
* _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python)
* bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding().
* What's new entry
2021-03-29 12:28:14 +09:00
Hai Shi 883bc63833
bpo-40275: Use new test.support helper submodules in tests (GH-21314) 2020-07-06 11:12:49 +02:00
Victor Stinner 63ab4ba07b
bpo-37210: Fix pure Python pickle when _pickle is unavailable (GH-14016)
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.
2019-06-13 13:58:51 +02:00
Antoine Pitrou 91f4380ced
bpo-36785: PEP 574 implementation (GH-7076) 2019-05-26 17:10:09 +02:00
Pierre Glaser 289f1f80ee bpo-35900: Enable custom reduction callback registration in _pickle (GH-12499)
Enable custom reduction callback registration for functions and classes in
_pickle.c, using the new Pickler's attribute ``reducer_override``.
2019-05-08 23:08:25 +02:00
Sergey Fedoseev 86b89916d1 Fix upsizing of marks stack in pickle module. (GH-8860)
Previously marks stack was upsized even there was space for additional item.
2018-08-25 10:54:40 +03:00
Serhiy Storchaka 0a2da50e18
bpo-31993: Do not create frames for large bytes and str objects (#5114)
when serialize into memory buffer with C pickle implementations.

This optimization already is performed when serialize into memory
with Python pickle implementations or into a file with both
implementations.
2018-01-11 13:03:20 +02:00
Serhiy Storchaka 986375ebde
bpo-28416: Break reference cycles in Pickler and Unpickler subclasses (#4080)
with the persistent_id() and persistent_load() methods.
2017-11-30 22:48:31 +02:00
Serhiy Storchaka 6545256df9
bpo-32032: Test both implementations of module-level pickle API. (#4401) 2017-11-15 14:01:08 +02:00
Eric Snow c943265ba5 Issue #15767: Add ModuleNotFoundError. 2016-09-07 15:42:32 -07:00
Serhiy Storchaka 90493ab30c Issue #25761: Improved error reporting about truncated pickle data in
C implementation of unpickler.  UnpicklingError is now raised instead of
AttributeError and ValueError in some cases.
2016-09-06 23:55:11 +03:00
Serhiy Storchaka 3410c01d83 Issue #17711: Fixed unpickling by the persistent ID with protocol 0.
Original patch by Alexandre Vassalotti.
2016-07-17 11:35:35 +03:00
Serhiy Storchaka dec25afab1 Issue #17711: Fixed unpickling by the persistent ID with protocol 0.
Original patch by Alexandre Vassalotti.
2016-07-17 11:24:17 +03:00
Serhiy Storchaka 9d4f3d81c7 Added exceptins for testing non-reversible import mapping for Issue #26013. 2016-01-18 22:34:19 +02:00
Serhiy Storchaka 5c1d9d2ff7 Added exceptins for testing non-reversible import mapping for Issue #26013. 2016-01-18 22:33:44 +02:00
Serhiy Storchaka 59fb6342a4 Issue #25761: Improved detecting errors in broken pickle data. 2015-12-06 22:01:35 +02:00
Serhiy Storchaka 3c49710e9f Issue #25761: Added more test cases for testing unpickling broken data.
Output raised exception at verbose level 2 (-vv).
2015-11-29 13:13:24 +02:00
Serhiy Storchaka 7279befccb Issue #25761: Added more test cases for testing unpickling broken data.
Output raised exception at verbose level 2 (-vv).
2015-11-29 13:12:10 +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
Serhiy Storchaka 456a27013e Issue #25365: test_pickle now works in threads disabled builds. 2015-10-10 20:10:54 +03:00
Serhiy Storchaka 7b2cfc4465 Issue #25365: test_pickle now works in threads disabled builds. 2015-10-10 20:10:07 +03:00
Serhiy Storchaka 104de66b76 Moved unpickling tests with prepickled data to separate class. 2015-09-29 15:34:53 +03:00
Serhiy Storchaka c6b54b45ea Moved unpickling tests with prepickled data to separate class. 2015-09-29 15:33:24 +03:00
Yury Selivanov f488fb422a Issue #19235: Add new RecursionError exception. Patch by Georg Brandl. 2015-07-03 01:04:23 -04:00
Yury Selivanov 7544508f02 PEP 0492 -- Coroutines with async and await syntax. Issue #24017. 2015-05-11 22:57:16 -04:00
Serhiy Storchaka b9100e5d9d Issue #18473: Fixed pickle compatibility tests for optional modules.
Added WindowsError to compatibility mappings.
2015-03-31 16:49:26 +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 5bbd231f27 Issue #15513: Added a __sizeof__ implementation for pickle classes. 2014-12-16 19:39:08 +02: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
Christian Heimes 2178248858 Issue #18339: use with self.assertRaises() to make test case more readable 2013-07-01 23:00:13 +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
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
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
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
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
Collin Winter 771d8341cd Port r71408 to py3k: issue 5665, add more pickling tests. 2009-04-16 03:18:06 +00:00
Alexandre Vassalotti ca2d610dba Restore _pickle module accelerator module.
Removed Windows support temporarily.
64bit bug with integer unpickling is now fixed.
2008-06-12 18:26:05 +00:00
Benjamin Peterson 75f25f2c9a revert the addition of _pickle because it was causing havok with 64-bit 2008-06-12 03:10:02 +00:00