@@ -3670,6 +3670,12 @@ class generic(_ArrayOrScalarCommon, Generic[_ItemT_co]):
36703670 @abstractmethod
36713671 def __new__ (cls , / , * args : Any , ** kwargs : Any ) -> Self : ...
36723672
3673+ # NOTE: Technically this doesn't exist at runtime, but it is unlikely to lead to
3674+ # type-unsafe situations (the abstract scalar types cannot be instantiated
3675+ # themselves) and is convenient to have, so we include it regardless. See
3676+ # https://github.com/numpy/numpy/issues/30445 for use-cases and discussion.
3677+ def __hash__ (self , / ) -> int : ...
3678+
36733679 if sys .version_info >= (3 , 12 ):
36743680 def __buffer__ (self , flags : int , / ) -> memoryview : ...
36753681
@@ -5728,6 +5734,10 @@ class bytes_(character[bytes], bytes): # type: ignore[misc]
57285734 @overload
57295735 def __new__ (cls , value : str , / , encoding : str , errors : str = "strict" ) -> Self : ...
57305736
5737+ #
5738+ @override
5739+ def __hash__ (self , / ) -> int : ...
5740+
57315741 #
57325742 def __bytes__ (self , / ) -> bytes : ...
57335743
@@ -5737,6 +5747,10 @@ class str_(character[str], str): # type: ignore[misc]
57375747 @overload
57385748 def __new__ (cls , value : bytes , / , encoding : str , errors : str = "strict" ) -> Self : ...
57395749
5750+ #
5751+ @override
5752+ def __hash__ (self , / ) -> int : ...
5753+
57405754# See `numpy._typing._ufunc` for more concrete nin-/nout-specific stubs
57415755@final
57425756class ufunc :
0 commit comments