[pypy-commit] pypy default: Do this whole operation without a copy
alex_gaynor
noreply at buildbot.pypy.org
Sun Mar 29 17:20:41 CEST 2015
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r76623:bea034347eb0
Date: 2015-03-29 11:20 -0400
http://bitbucket.org/pypy/pypy/changeset/bea034347eb0/
Log: Do this whole operation without a copy
diff --git a/pypy/module/_hashlib/interp_hashlib.py b/pypy/module/_hashlib/interp_hashlib.py
--- a/pypy/module/_hashlib/interp_hashlib.py
+++ b/pypy/module/_hashlib/interp_hashlib.py
@@ -144,10 +144,10 @@
with self.lock:
ropenssl.EVP_MD_CTX_copy(ctx, self.ctx)
digest_size = self.digest_size
- with lltype.scoped_alloc(rffi.CCHARP.TO, digest_size) as digest:
- ropenssl.EVP_DigestFinal(ctx, digest, None)
+ with rffi.scoped_alloc_buffer(digest_size) as buf:
+ ropenssl.EVP_DigestFinal(ctx, buf.raw, None)
ropenssl.EVP_MD_CTX_cleanup(ctx)
- return rffi.charpsize2str(digest, digest_size)
+ return buf.str(digest_size)
W_Hash.typedef = TypeDef(
More information about the pypy-commit
mailing list