comparison mercurial/pycompat.py @ 29324:b501579147f1

py3: conditionalize cPickle import by adding in util The cPickle is renamed to _pickle in python3 and this C extension is available in pickle which was not included in earlier versions. So imports are conditionalized to import cPickle in py2 and pickle in py3. Moreover the use of pickle in py2 is switched to cPickle as the C extension is faster. The hack is added in util.py and the modules import util.pickle
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 04 Jun 2016 14:38:00 +0530
parents 800ec7c048b0
children fbe380dc227a
comparison
equal deleted inserted replaced
29321:de4a80a2b45c 29324:b501579147f1
7 7
8 This contains aliases to hide python version-specific details from the core. 8 This contains aliases to hide python version-specific details from the core.
9 """ 9 """
10 10
11 from __future__ import absolute_import 11 from __future__ import absolute_import
12
13 try:
14 import cPickle as pickle
15 pickle.dumps
16 except ImportError:
17 import pickle
12 18
13 try: 19 try:
14 import cStringIO as io 20 import cStringIO as io
15 stringio = io.StringIO 21 stringio = io.StringIO
16 except ImportError: 22 except ImportError: