BaseTools: Use pickle to replace cPickle
Use pickle to replace cPickle because of python3 removed cPickle Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
26067e30c4
commit
3a0c1bf64b
@@ -21,7 +21,7 @@ import string
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import cPickle
|
import pickle
|
||||||
import array
|
import array
|
||||||
import shutil
|
import shutil
|
||||||
from struct import pack
|
from struct import pack
|
||||||
@@ -499,7 +499,7 @@ def DataDump(Data, File):
|
|||||||
Fd = None
|
Fd = None
|
||||||
try:
|
try:
|
||||||
Fd = open(File, 'wb')
|
Fd = open(File, 'wb')
|
||||||
cPickle.dump(Data, Fd, cPickle.HIGHEST_PROTOCOL)
|
pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)
|
||||||
except:
|
except:
|
||||||
EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False)
|
EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False)
|
||||||
finally:
|
finally:
|
||||||
@@ -518,7 +518,7 @@ def DataRestore(File):
|
|||||||
Fd = None
|
Fd = None
|
||||||
try:
|
try:
|
||||||
Fd = open(File, 'rb')
|
Fd = open(File, 'rb')
|
||||||
Data = cPickle.load(Fd)
|
Data = pickle.load(Fd)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))
|
EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))
|
||||||
Data = None
|
Data = None
|
||||||
|
Reference in New Issue
Block a user