aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2022-02-06 16:36:49 +0200
committerMatti Picus <matti.picus@gmail.com>2022-02-06 16:36:49 +0200
commitcd6e2b21042ea35fe14f5c1853760292130b3f54 (patch)
tree2a6ab427dd5970222b39e2748a4e3fc85f731edb
parentdisable _locale.gettext and friends on macOS like on CPython (diff)
downloadpypy-cd6e2b21042ea35fe14f5c1853760292130b3f54.tar.gz
pypy-cd6e2b21042ea35fe14f5c1853760292130b3f54.tar.bz2
pypy-cd6e2b21042ea35fe14f5c1853760292130b3f54.zip
allow hashing memoryviews (issue 2756)
-rw-r--r--lib_pypy/_hashlib/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib_pypy/_hashlib/__init__.py b/lib_pypy/_hashlib/__init__.py
index 070bcdba5c..ad5b76a301 100644
--- a/lib_pypy/_hashlib/__init__.py
+++ b/lib_pypy/_hashlib/__init__.py
@@ -10,6 +10,9 @@ except ImportError: builtinify = lambda f: f
def new(name, string=b''):
h = HASH(name)
+ if isinstance(string, memoryview):
+ # issue 2756: ffi.from_buffer() cannot handle memoryviews
+ string = string.tobytes()
h.update(string)
return h