Skip to content

Commit

Permalink
Merge pull request diffpy#70 from dragonyanglong/pickle_protocol_highest
Browse files Browse the repository at this point in the history
REV: revert pickle protocol back to the highest one.
  • Loading branch information
sbillinge authored Dec 26, 2021
2 parents 7441215 + b4d69c6 commit e3f80ac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/diffpy/pdfgui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from six.moves.configparser import RawConfigParser
import six.moves.cPickle as pickle

# keep project files compatible with Python 2
PDFGUI_PICKLE_PROTOCOL = 2
# protocol=2 keep project files compatible with Python 2
# PDFGUI_PICKLE_PROTOCOL = 2


def numericStringSort(lst):
Expand Down Expand Up @@ -59,7 +59,7 @@ def pickle_loads(sdata, encoding="latin1"):

def safeCPickleDumps(obj):
"""Get pickle representation of an object possibly containing NaN or Inf.
By default it uses PDFGUI_PICKLE_PROTOCOL, but falls back to ASCII
By default it uses pickle.HIGHEST_PROTOCOL, but falls back to ASCII
protocol 0 if there is SystemError frexp() exception.
obj -- object to be pickled
Expand All @@ -68,7 +68,7 @@ def safeCPickleDumps(obj):
"""
ascii_protocol = 0
try:
s = pickle.dumps(obj, PDFGUI_PICKLE_PROTOCOL)
s = pickle.dumps(obj, pickle.HIGHEST_PROTOCOL)
except SystemError:
s = pickle.dumps(obj, ascii_protocol)
return s
Expand Down

0 comments on commit e3f80ac

Please sign in to comment.