From cd6e2b21042ea35fe14f5c1853760292130b3f54 Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Sun, 6 Feb 2022 16:36:49 +0200 Subject: allow hashing memoryviews (issue 2756) --- lib_pypy/_hashlib/__init__.py | 3 +++ 1 file changed, 3 insertions(+) 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 -- cgit v1.2.3-65-gdbad