diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 87623557d7bc..50ced396888f 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -115,8 +115,10 @@ class object: def __init_subclass__(cls) -> None: ... class staticmethod(Generic[_R_co]): - __func__: Callable[..., _R_co] - __isabstractmethod__: bool + @property + def __func__(self) -> Callable[..., _R_co]: ... + @property + def __isabstractmethod__(self) -> bool: ... def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): @@ -126,8 +128,10 @@ class staticmethod(Generic[_R_co]): def __call__(self, *args: Any, **kwargs: Any) -> _R_co: ... class classmethod(Generic[_R_co]): - __func__: Callable[..., _R_co] - __isabstractmethod__: bool + @property + def __func__(self) -> Callable[..., _R_co]: ... + @property + def __isabstractmethod__(self) -> bool: ... def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): @@ -136,19 +140,28 @@ class classmethod(Generic[_R_co]): __wrapped__: Callable[..., _R_co] class type: - __base__: type + @property + def __base__(self) -> type: ... __bases__: tuple[type, ...] - __basicsize__: int - __dict__: dict[str, Any] - __dictoffset__: int - __flags__: int - __itemsize__: int + @property + def __basicsize__(self) -> int: ... + @property + def __dict__(self) -> types.MappingProxyType[str, Any]: ... # type: ignore[override] + @property + def __dictoffset__(self) -> int: ... + @property + def __flags__(self) -> int: ... + @property + def __itemsize__(self) -> int: ... __module__: str - __mro__: tuple[type, ...] + @property + def __mro__(self) -> tuple[type, ...]: ... __name__: str __qualname__: str - __text_signature__: str | None - __weakrefoffset__: int + @property + def __text_signature__(self) -> str | None: ... + @property + def __weakrefoffset__(self) -> int: ... @overload def __init__(self, __o: object) -> None: ... @overload diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index e4fe05c80536..93ff491ff169 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -48,6 +48,7 @@ sqlite3.Binary.__contains__ # C type that implements __getitem__ builtins.object.__init__ # default C signature is incorrect builtins.property.__get__ # this function can accept no value for the type parameter. builtins.staticmethod.__get__ # this function can accept no value for the type parameter. +builtins.type.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute. bz2.BZ2Decompressor.__init__ # function does not accept parameters but C signature is set # The following CodecInfo properties are added in __new__ codecs.CodecInfo.decode