From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web10.2113.1602553616082246402 for ; Mon, 12 Oct 2020 18:46:57 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: fengyunhua@byosoft.com.cn) Received: from LAPTOP2AECFQIA ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 13 Oct 2020 09:46:53 +0800 X-WM-Sender: fengyunhua@byosoft.com.cn X-WM-AuthFlag: YES X-WM-AuthUser: fengyunhua@byosoft.com.cn From: "fengyunhua" To: Cc: , Subject: [PATCH] BaseTools: array.fromstring and array.tostring removed in python 3.9 Date: Tue, 13 Oct 2020 09:46:54 +0800 Message-ID: <000201d6a102$ba711cf0$2f5356d0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdahAp5B/m0p1XkwRqWWeON2NQgtRA== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn array.fromstring and array.tostring deprecated, and alias for array.frombytes and array.tobytes. Deprecated since version 3.2, have been removed in version python 3.9. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/Eot/EotMain.py | 10 +++++----- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/Eot/EotMain.py = b/BaseTools/Source/Python/Eot/EotMain.py index 791fcdfeae..08bb2de172 100644 --- a/BaseTools/Source/Python/Eot/EotMain.py +++ b/BaseTools/Source/Python/Eot/EotMain.py @@ -152,11 +152,11 @@ class CompressedImage(Image): try: TmpData =3D DeCompress('Efi', self[self._HEADER_SIZE_:]) DecData =3D array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) except: TmpData =3D DeCompress('Framework', = self[self._HEADER_SIZE_:]) DecData =3D array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) =20 SectionList =3D [] Offset =3D 0 @@ -196,7 +196,7 @@ class Ui(Image): return len(self) =20 def _GetUiString(self): - return codecs.utf_16_decode(self[0:-2].tostring())[0] + return codecs.utf_16_decode(self[0:-2].tobytes())[0] =20 String =3D property(_GetUiString) =20 @@ -738,7 +738,7 @@ class GuidDefinedImage(Image): Offset =3D self.DataOffset - 4 TmpData =3D DeCompress('Framework', self[self.Offset:]) DecData =3D array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) Offset =3D 0 while Offset < len(DecData): Sec =3D Section() @@ -759,7 +759,7 @@ class GuidDefinedImage(Image): =20 TmpData =3D DeCompress('Lzma', self[self.Offset:]) DecData =3D array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) Offset =3D 0 while Offset < len(DecData): Sec =3D Section() diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py = b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index dc1727c466..124dc43199 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -463,12 +463,12 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.SecCmdList.append(' = '.join(Cmd).strip()) else: SectionData =3D array('B', [0, 0, 0, 0]) - SectionData.fromstring(Ui.encode("utf_16_le")) + SectionData.frombytes(Ui.encode("utf_16_le")) SectionData.append(0) SectionData.append(0) Len =3D len(SectionData) = GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, 0, Len & 0xff, = (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15) - SaveFileOnChange(Output, SectionData.tostring()) + SaveFileOnChange(Output, SectionData.tobytes()) =20 elif Ver: Cmd +=3D ("-n", Ver) --=20 2.27.0.windows.1