]> granicus.if.org Git - python/commitdiff
Check that Python is 64-bit before enabling BLAKE2_USE_SSE. (GH-1332) (GH-2042)
authorNeil Schemenauer <nas-github@arctrix.com>
Fri, 16 Jun 2017 02:12:46 +0000 (19:12 -0700)
committerMariatta <Mariatta@users.noreply.github.com>
Fri, 16 Jun 2017 02:12:46 +0000 (19:12 -0700)
(cherry picked from commit 6c991bdee7ec4bedd8c1b8d3812dc884b654b57c)

setup.py

index f04bf229f1fa97b862f064eb2eeb0553ff571b74..fe477974bd0b7e35d022acae6a45948bed175313 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -897,8 +897,11 @@ class PyBuildExt(build_ext):
         blake2_deps.append('hashlib.h')
 
         blake2_macros = []
-        if not cross_compiling and os.uname().machine == "x86_64":
-            # Every x86_64 machine has at least SSE2.
+        if (not cross_compiling and
+                os.uname().machine == "x86_64" and
+                sys.maxsize >  2**32):
+            # Every x86_64 machine has at least SSE2.  Check for sys.maxsize
+            # in case that kernel is 64-bit but userspace is 32-bit.
             blake2_macros.append(('BLAKE2_USE_SSE', '1'))
 
         exts.append( Extension('_blake2',