Browse Source

dist: Fix error building Windows executable in Python 3.9

rdb 5 years ago
parent
commit
f88441c584
1 changed files with 5 additions and 1 deletions
  1. 5 1
      direct/src/dist/pefile.py

+ 5 - 1
direct/src/dist/pefile.py

@@ -246,7 +246,11 @@ class VersionInfoResource(object):
         length, value_length = unpack('<HH', data[0:4])
         offset = 40 + value_length + (value_length & 1)
         dwords = array('I')
-        dwords.fromstring(bytes(data[40:offset]))
+        if sys.version_info >= (3, 2):
+            dwords.frombytes(bytes(data[40:offset]))
+        else:
+            dwords.fromstring(bytes(data[40:offset]))
+
         if len(dwords) > 0:
             self.signature = dwords[0]
         if len(dwords) > 1: