From 9c64b6fb869509f6d5e87a63a7b75970aa8533d2 Mon Sep 17 00:00:00 2001 From: Jan Vesely Date: Fri, 6 May 2022 10:25:50 -0400 Subject: [PATCH] compat: Import Pickler from "pickle" instead of "_pickle" The latter is an implementation detail (see [0]), and the docs instruct users to "always import the standard version"[0]. Moreover, "pickle.Pickler" is the same as "_pickle.Pickler", for all recent CPython releases (tested 3.6->3.9). [0] https://docs.python.org/3.1/whatsnew/3.0.html#library-changes Fixes: https://github.com/cloudpipe/cloudpickle/issues/458 Signed-off-by: Jan Vesely --- cloudpickle/compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudpickle/compat.py b/cloudpickle/compat.py index afa285f62..a05772185 100644 --- a/cloudpickle/compat.py +++ b/cloudpickle/compat.py @@ -7,7 +7,7 @@ from pickle5 import Pickler # noqa: F401 except ImportError: import pickle # noqa: F401 - from pickle import _Pickler as Pickler # noqa: F401 + from pickle import Pickler as Pickler # noqa: F401 else: import pickle # noqa: F401 - from _pickle import Pickler # noqa: F401 + from pickle import Pickler # noqa: F401