From 553bda4d8ea4beb243a5915da4208d77e6911e12 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 25 Feb 2021 16:28:26 -0600 Subject: [PATCH] BaseTools: array.fromstring and array.tostring removed in python 3.9 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 +++++----- 1 file changed, 5 insertions(+), 5 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 = DeCompress('Efi', self[self._HEADER_SIZE_:]) DecData = array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) except: TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:]) DecData = array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) SectionList = [] Offset = 0 @@ -196,7 +196,7 @@ class Ui(Image): return len(self) def _GetUiString(self): - return codecs.utf_16_decode(self[0:-2].tostring())[0] + return codecs.utf_16_decode(self[0:-2].tobytes())[0] String = property(_GetUiString) @@ -738,7 +738,7 @@ class GuidDefinedImage(Image): Offset = self.DataOffset - 4 TmpData = DeCompress('Framework', self[self.Offset:]) DecData = array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) Offset = 0 while Offset < len(DecData): Sec = Section() @@ -759,7 +759,7 @@ class GuidDefinedImage(Image): TmpData = DeCompress('Lzma', self[self.Offset:]) DecData = array('B') - DecData.fromstring(TmpData) + DecData.frombytes(TmpData) Offset = 0 while Offset < len(DecData): Sec = Section()