BaseTools: Use pickle to replace cPickle
authorYunhua Feng <yunhuax.feng@intel.com>
Tue, 31 Jul 2018 08:32:57 +0000 (16:32 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 2 Aug 2018 07:12:34 +0000 (15:12 +0800)
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>
BaseTools/Source/Python/Common/Misc.py

index fd948c7..74a5f0b 100644 (file)
@@ -21,7 +21,7 @@ import string
 import threading\r
 import time\r
 import re\r
-import cPickle\r
+import pickle\r
 import array\r
 import shutil\r
 from struct import pack\r
@@ -499,7 +499,7 @@ def DataDump(Data, File):
     Fd = None\r
     try:\r
         Fd = open(File, 'wb')\r
-        cPickle.dump(Data, Fd, cPickle.HIGHEST_PROTOCOL)\r
+        pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)\r
     except:\r
         EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False)\r
     finally:\r
@@ -518,7 +518,7 @@ def DataRestore(File):
     Fd = None\r
     try:\r
         Fd = open(File, 'rb')\r
-        Data = cPickle.load(Fd)\r
+        Data = pickle.load(Fd)\r
     except Exception as e:\r
         EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))\r
         Data = None\r