[issue30192] hashlib module breaks with 64-bit kernel and 32-bit user space

Neil Schemenauer report at bugs.python.org
Thu Apr 27 17:20:03 EDT 2017


New submission from Neil Schemenauer:

The test in setup.py to check for SSE2 support is incorrect.  Checking that arch == x86_64 is not sufficient.  If the kernel is 64-bit but Python is compiled with a 32-bit compiler, the _blake2 module will fail to build.

The attached patch fixes this issue. I did a quick search of the x86_64 string, I don't see this mistake being made elsewhere but I imagine it could be done elsewhere.  Obviously a machine with a 64-bit kernel and 32-bit userspace is a rare as hen's teeth these days.  Still, I think it is worth fixing this bug.

Python 3.6.1 (default, Apr 27 2017, 20:09:03) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
ERROR:root:code for hash blake2b was not found.
Traceback (most recent call last):
  File "/home/nas/PPython-3.6.1/Lib/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/nas/PPython-3.6.1/Lib/hashlib.py", line 119, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/nas/PPython-3.6.1/Lib/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2b
ERROR:root:code for hash blake2s was not found.
Traceback (most recent call last):
  File "/home/nas/PPython-3.6.1/Lib/hashlib.py", line 243, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/nas/PPython-3.6.1/Lib/hashlib.py", line 119, in __get_openssl_constructor
    return __get_builtin_constructor(name)
  File "/home/nas/PPython-3.6.1/Lib/hashlib.py", line 113, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2s

----------
components: Build
messages: 292485
nosy: nascheme
priority: normal
severity: normal
stage: patch review
status: open
title: hashlib module breaks with 64-bit kernel and 32-bit user space
type: compile error
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30192>
_______________________________________


More information about the Python-bugs-list mailing list