[Python-checkins] bpo-35346: Cleanup platform.architecture() (GH-11130)

Victor Stinner webhook-mailer at python.org
Fri Dec 14 07:14:14 EST 2018


https://github.com/python/cpython/commit/4aa917c5feaec07a6f6db87b34185ab6180e20ee
commit: 4aa917c5feaec07a6f6db87b34185ab6180e20ee
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018年12月14日T13:14:10+01:00
summary:
bpo-35346: Cleanup platform.architecture() (GH-11130)
struct.calcsize('P') now always works.
files:
M Lib/platform.py
diff --git a/Lib/platform.py b/Lib/platform.py
index ab0cf254bc69..0fe841c71ce6 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -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:


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /