Skip to content

Commit 6c991bd

Browse files
authored
Check that Python is 64-bit before enabling BLAKE2_USE_SSE. (#1332)
1 parent d1a1def commit 6c991bd

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
@@ -898,8 +898,11 @@ def detect_modules(self):
898898
blake2_deps.append('hashlib.h')
899899

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

905908
exts.append( Extension('_blake2',

0 commit comments

Comments
 (0)