https://github.com/python/cpython/commit/dfd421467feb3ffc20a34d67341bf0e768ed1f02
commit: dfd421467feb3ffc20a34d67341bf0e768ed1f02
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-07-19T15:28:20Z
summary:

[3.14] gh-139806: Mention pickle error changes in What's New in 3.14 
(GH-154020) (GH-154162)

The gh-122311 changes made pickle.dump() and pickle.dumps() raise
PicklingError for some failures that previously raised AttributeError,
ImportError, ValueError or UnicodeEncodeError, depending on the
implementation.
Add an entry about this in the "Porting to Python 3.14" section.
(cherry picked from commit eb447081ed8182f825fa01953ec87cff41f3d585)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>

files:
M Doc/whatsnew/3.14.rst

diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index 868a5275b3c4625..72ef7e6079281e7 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -3309,6 +3309,16 @@ Changes in the Python API
   This temporary change affects other threads.
   (Contributed by Serhiy Storchaka in :gh:`69998`.)
 
+* :func:`pickle.dump` and :func:`pickle.dumps` now raise
+  :exc:`~pickle.PicklingError` for some failures that previously raised
+  :exc:`AttributeError`, :exc:`ImportError`, :exc:`ValueError`,
+  :exc:`UnicodeEncodeError` or :exc:`!PicklingError`,
+  depending on the implementation
+  (for example, pickling a local object, or an object whose module cannot be 
imported).
+  The original exception is chained to the :exc:`!PicklingError`.
+  Code that caught these exceptions should also catch :exc:`!PicklingError`.
+  (Contributed by Serhiy Storchaka in :gh:`122311`.)
+
 * :class:`types.UnionType` is now an alias for :class:`typing.Union`,
   causing changes in some behaviors.
   See :ref:`above <whatsnew314-typing-union>` for more details.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to