Skip to content

Commit 9cead06

Browse files
naschemeMariatta
authored andcommitted
Check that Python is 64-bit before enabling BLAKE2_USE_SSE. (GH-1332) (GH-2042)
(cherry picked from commit 6c991bd)
1 parent 6a90a12 commit 9cead06

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,11 @@ def detect_modules(self):
897897
blake2_deps.append('hashlib.h')
898898

899899
blake2_macros = []
900-
if not cross_compiling and os.uname().machine == "x86_64":
901-
# Every x86_64 machine has at least SSE2.
900+
if (not cross_compiling and
901+
os.uname().machine == "x86_64" and
902+
sys.maxsize > 2**32):
903+
# Every x86_64 machine has at least SSE2. Check for sys.maxsize
904+
# in case that kernel is 64-bit but userspace is 32-bit.
902905
blake2_macros.append(('BLAKE2_USE_SSE', '1'))
903906

904907
exts.append( Extension('_blake2',

0 commit comments

Comments
 (0)