Author: Alex Gaynor <alex.gay...@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( _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit