From 197aa22f29c5ef373d9493feccf668afd216958b Mon Sep 17 00:00:00 2001 From: micbou Date: Wed, 20 Jun 2018 14:34:39 +0200 Subject: [PATCH] Use cPickle on Python 2 if available Attempt to load the C version of pickle on Python 2 as it is way faster. --- jedi/_compatibility.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 3aef7eb9..92cd2c36 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -381,8 +381,12 @@ if is_py3: else: import Queue as queue - -import pickle +try: + # Attempt to load the C implementation of pickle on Python 2 as it is way + # faster. + import cPickle as pickle +except ImportError: + import pickle if sys.version_info[:2] == (3, 3): """ Monkeypatch the unpickler in Python 3.3. This is needed, because the