]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35346: Cleanup platform.architecture() (GH-11130)
authorVictor Stinner <vstinner@redhat.com>
Fri, 14 Dec 2018 12:14:10 +0000 (13:14 +0100)
committerGitHub <noreply@github.com>
Fri, 14 Dec 2018 12:14:10 +0000 (13:14 +0100)
struct.calcsize('P') now always works.

Lib/platform.py

index ab0cf254bc69cf018df04dd5684c35c4ba45ee0a..0fe841c71ce675eef09fbac46699df62f41ebf4e 100755 (executable)
@@ -651,12 +651,8 @@ def architecture(executable=sys.executable, bits='', linkage=''):
     # else is given as default.
     if not bits:
         import struct
-        try:
-            size = struct.calcsize('P')
-        except struct.error:
-            # Older installations can only query longs
-            size = struct.calcsize('l')
-        bits = str(size*8) + 'bit'
+        size = struct.calcsize('P')
+        bits = str(size * 8) + 'bit'
 
     # Get data from the 'file' system command
     if executable: