public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Yunhua Feng <yunhuax.feng@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH] BaseTools: Use pickle to replace cPickle
Date: Tue, 31 Jul 2018 20:24:28 +0800	[thread overview]
Message-ID: <1533039868-11704-1-git-send-email-yonghong.zhu@intel.com> (raw)

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



             reply	other threads:[~2018-07-31 12:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 12:24 Yonghong Zhu [this message]
2018-08-01  0:41 ` [PATCH] BaseTools: Use pickle to replace cPickle Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533039868-11704-1-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox