From e3471a2fc2e3029d125b13f8ebb9299c70a19cba Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Tue, 16 Mar 2021 12:13:37 +0200 Subject: [PATCH] Drop obsolete code importing pickle (#1315) https://docs.python.org/3.9/whatsnew/3.0.html#library-changes > A common pattern in Python 2.x is to have one version of a module implemented in pure Python, with an optional accelerated version implemented as a C extension; for example, pickle and cPickle. This places the burden of importing the accelerated version and falling back on the pure Python version on each user of these modules. In Python 3.0, the accelerated versions are considered implementation details of the pure Python versions. Users should always import the standard version, which attempts to import the accelerated version and falls back to the pure Python version. The pickle / cPickle pair received this treatment. --- kombu/serialization.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/kombu/serialization.py b/kombu/serialization.py index d7034a29..ed7bb315 100644 --- a/kombu/serialization.py +++ b/kombu/serialization.py @@ -2,14 +2,9 @@ import codecs import os +import pickle import sys -import pickle as pypickle -try: - import cPickle as cpickle -except ImportError: # pragma: no cover - cpickle = None # noqa - from collections import namedtuple from contextlib import contextmanager from io import BytesIO @@ -32,7 +27,6 @@ if sys.platform.startswith('java'): # pragma: no cover else: _decode = codecs.decode -pickle = cpickle or pypickle pickle_load = pickle.load #: We have to use protocol 4 until we drop support for Python 3.6 and 3.7.