MCPcopy Index your code
hub / github.com/python/cpython / _openssl_new

Function _openssl_new

Lib/test/support/hashlib_helper.py:646–662  ·  view source on GitHub ↗

Check availability of _hashlib.new(digestname, **kwargs). The constructor function is returned (without binding **kwargs), or SkipTest is raised if none exists.

(digestname, /, **kwargs)

Source from the content-addressed store, hash-verified

644
645
646def _openssl_new(digestname, /, **kwargs):
647 """Check availability of _hashlib.new(digestname, **kwargs).
648
649 The constructor function is returned (without binding **kwargs),
650 or SkipTest is raised if none exists.
651 """
652 assert isinstance(digestname, str), digestname
653 try:
654 # re-import '_hashlib' in case it was mocked
655 _hashlib = importlib.import_module("_hashlib")
656 except ImportError as exc:
657 raise SkipNoHash(digestname, "openssl") from exc
658 try:
659 _hashlib.new(digestname, **kwargs)
660 except ValueError as exc:
661 raise SkipNoHashInCall("_hashlib.new", digestname) from exc
662 return functools.partial(_hashlib.new, digestname)
663
664
665def _openssl_hash(digestname, /, **kwargs):

Callers

nothing calls this directly

Calls 5

SkipNoHashClass · 0.85
SkipNoHashInCallClass · 0.85
partialMethod · 0.80
import_moduleMethod · 0.45
newMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…