Skip to content

Commit

Permalink
TCBZ3136: Fix Python 3.9 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bret Barkelew authored and kenlautner committed May 4, 2023
1 parent 36bcf72 commit aa32c8a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions BaseTools/Source/Python/Eot/EotMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ def _GetSections(self):
try:
TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:])
DecData = array('B')
DecData.fromstring(TmpData)
DecData.frombytes(TmpData) # MU_CHANGE use frombytes instead of fromstring - TCBZ3136
except:
TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:])
DecData = array('B')
DecData.fromstring(TmpData)
# MU_CHANGE use frombytes instead of fromstring - TCBZ3136
DecData.frombytes(TmpData)

SectionList = []
Offset = 0
Expand Down Expand Up @@ -196,7 +197,7 @@ def _Unpack(self):
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] # MU_CHANGE use tobytes instead of tostring - TCBZ3136

String = property(_GetUiString)

Expand Down Expand Up @@ -738,7 +739,7 @@ def _GetSections(self):
Offset = self.DataOffset - 4
TmpData = DeCompress('Framework', self[self.Offset:])
DecData = array('B')
DecData.fromstring(TmpData)
DecData.frombytes(TmpData) # MU_CHANGE use frombytes instead of fromstring - TCBZ3136
Offset = 0
while Offset < len(DecData):
Sec = Section()
Expand All @@ -759,7 +760,7 @@ def _GetSections(self):

TmpData = DeCompress('Lzma', self[self.Offset:])
DecData = array('B')
DecData.fromstring(TmpData)
DecData.frombytes(TmpData) # MU_CHANGE use frombytes instead of fromstring - TCBZ3136
Offset = 0
while Offset < len(DecData):
Sec = Section()
Expand Down

0 comments on commit aa32c8a

Please sign in to comment.