Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r90617:6f28fc42ee45 Date: 2017-03-10 09:37 +0100 http://bitbucket.org/pypy/pypy/changeset/6f28fc42ee45/
Log: issue #2494: @builtinfy some functions diff --git a/lib_pypy/_hashlib/__init__.py b/lib_pypy/_hashlib/__init__.py --- a/lib_pypy/_hashlib/__init__.py +++ b/lib_pypy/_hashlib/__init__.py @@ -4,6 +4,10 @@ from _cffi_ssl._stdssl.utility import (_str_to_ffi_buffer, _bytes_with_len, _str_from_buf) +try: from __pypy__ import builtinify +except ImportError: builtinify = lambda f: f + + def new(name, string=b''): h = Hash(name) h.update(string) @@ -132,6 +136,7 @@ # shortcut functions def make_new_hash(name, funcname): + @builtinify def new_hash(string=b''): return new(name, string) new_hash.__name__ = funcname @@ -142,6 +147,7 @@ globals()[_newname] = make_new_hash(_name, _newname) if hasattr(lib, 'PKCS5_PBKDF2_HMAC'): + @builtinify def pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None): if not isinstance(hash_name, str): raise TypeError("expected 'str' for name, but got %s" % type(hash_name)) diff --git a/lib_pypy/_ssl/__init__.py b/lib_pypy/_ssl/__init__.py --- a/lib_pypy/_ssl/__init__.py +++ b/lib_pypy/_ssl/__init__.py @@ -1,3 +1,12 @@ from _cffi_ssl._stdssl import (_PROTOCOL_NAMES, _OPENSSL_API_VERSION, _test_decode_cert, _SSLContext) from _cffi_ssl._stdssl import * + + +try: from __pypy__ import builtinify +except ImportError: builtinify = lambda f: f + +RAND_add = builtinify(RAND_add) +RAND_bytes = builtinify(RAND_bytes) +RAND_egd = builtinify(RAND_egd) +RAND_pseudo_bytes = builtinify(RAND_pseudo_bytes) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit