public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] BaseTools: Use pickle to replace cPickle
@ 2018-07-31 12:24 Yonghong Zhu
  2018-08-01  0:41 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2018-07-31 12:24 UTC (permalink / raw)
  To: edk2-devel; +Cc: Yunhua Feng, Liming Gao

From: Yunhua Feng <yunhuax.feng@intel.com>

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>
---
 BaseTools/Source/Python/Common/Misc.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index fd948c727a..74a5f0bca5 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -19,11 +19,11 @@ import Common.LongFilePathOs as os
 import sys
 import string
 import threading
 import time
 import re
-import cPickle
+import pickle
 import array
 import shutil
 from struct import pack
 from UserDict import IterableUserDict
 from UserList import UserList
@@ -497,11 +497,11 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True):
 #
 def DataDump(Data, File):
     Fd = None
     try:
         Fd = open(File, 'wb')
-        cPickle.dump(Data, Fd, cPickle.HIGHEST_PROTOCOL)
+        pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)
     except:
         EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False)
     finally:
         if Fd is not None:
             Fd.close()
@@ -516,11 +516,11 @@ def DataDump(Data, File):
 def DataRestore(File):
     Data = None
     Fd = None
     try:
         Fd = open(File, 'rb')
-        Data = cPickle.load(Fd)
+        Data = pickle.load(Fd)
     except Exception as e:
         EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))
         Data = None
     finally:
         if Fd is not None:
-- 
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-01  0:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31 12:24 [PATCH] BaseTools: Use pickle to replace cPickle Yonghong Zhu
2018-08-01  0:41 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox