Introduce the _HashObject protocol (#13553)

This protocol corresponds to what is called "hash object" in the hashlib documentation. In particular, it includes the non-OpenSSL BLAKE2 implementations which do not inherit HASH.
This commit is contained in:
Pierre Chapuis
2025-02-27 15:31:56 +01:00
committed by GitHub
parent 14605d0c21
commit b0c6fffe28
3 changed files with 19 additions and 5 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
import sys
from _hashlib import HASH as _HashlibHash
from _hashlib import _HashObject
from _typeshed import ReadableBuffer, SizedBuffer
from collections.abc import Callable
from types import ModuleType
from typing import AnyStr, overload
from typing_extensions import TypeAlias
_DigestMod: TypeAlias = str | Callable[[], _HashlibHash] | ModuleType
_DigestMod: TypeAlias = str | Callable[[], _HashObject] | ModuleType
trans_5C: bytes
trans_36: bytes