Skip to content

Commit e3f80ac

Browse files
authored
Merge pull request #70 from dragonyanglong/pickle_protocol_highest
REV: revert pickle protocol back to the highest one.
2 parents 7441215 + b4d69c6 commit e3f80ac

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/diffpy/pdfgui/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
from six.moves.configparser import RawConfigParser
2424
import six.moves.cPickle as pickle
2525

26-
# keep project files compatible with Python 2
27-
PDFGUI_PICKLE_PROTOCOL = 2
26+
# protocol=2 keep project files compatible with Python 2
27+
# PDFGUI_PICKLE_PROTOCOL = 2
2828

2929

3030
def numericStringSort(lst):
@@ -59,7 +59,7 @@ def pickle_loads(sdata, encoding="latin1"):
5959

6060
def safeCPickleDumps(obj):
6161
"""Get pickle representation of an object possibly containing NaN or Inf.
62-
By default it uses PDFGUI_PICKLE_PROTOCOL, but falls back to ASCII
62+
By default it uses pickle.HIGHEST_PROTOCOL, but falls back to ASCII
6363
protocol 0 if there is SystemError frexp() exception.
6464
6565
obj -- object to be pickled
@@ -68,7 +68,7 @@ def safeCPickleDumps(obj):
6868
"""
6969
ascii_protocol = 0
7070
try:
71-
s = pickle.dumps(obj, PDFGUI_PICKLE_PROTOCOL)
71+
s = pickle.dumps(obj, pickle.HIGHEST_PROTOCOL)
7272
except SystemError:
7373
s = pickle.dumps(obj, ascii_protocol)
7474
return s

0 commit comments

Comments
 (0)