* [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
* Re: [PATCH] BaseTools: Use pickle to replace cPickle
2018-07-31 12:24 [PATCH] BaseTools: Use pickle to replace cPickle Yonghong Zhu
@ 2018-08-01 0:41 ` Zhu, Yonghong
0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-08-01 0:41 UTC (permalink / raw)
To: Zhu, Yonghong, edk2-devel@lists.01.org; +Cc: Gao, Liming, Zhu, Yonghong
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu
Sent: Tuesday, July 31, 2018 8:24 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: [edk2] [PATCH] BaseTools: Use pickle to replace cPickle
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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ 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