From c6d0ff187edb3742f05d76230f275105cc959ffb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 1 Nov 2026 19:08:24 +0000 Subject: [PATCH] Restore read-only properties on builtins.type --- stdlib/builtins.pyi | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 0075adf561c2..cf2cf8a22985 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -182,21 +182,29 @@ class classmethod(Generic[_T, _P, _R_co]): @disjoint_base class type: # object.__base__ is None. Otherwise, it would be a type. - __base__: Final[type | None] + @property + def __base__(self) -> type | None: ... __bases__: tuple[type, ...] - __basicsize__: Final[int] + @property + def __basicsize__(self) -> int: ... # type.__dict__ is read-only at runtime, but that can't be expressed currently. # See https://github.com/python/typeshed/issues/11033 for a discussion. __dict__: Final[types.MappingProxyType[str, Any]] # type: ignore[assignment] - __dictoffset__: Final[int] - __flags__: Final[int] - __itemsize__: Final[int] + @property + def __dictoffset__(self) -> int: ... + @property + def __flags__(self) -> int: ... + @property + def __itemsize__(self) -> int: ... __module__: str - __mro__: Final[tuple[type, ...]] + @property + def __mro__(self) -> tuple[type, ...]: ... __name__: str __qualname__: str - __text_signature__: Final[str | None] - __weakrefoffset__: Final[int] + @property + def __text_signature__(self) -> str | None: ... + @property + def __weakrefoffset__(self) -> int: ... @overload def __init__(self, o: object, /) -> None: ...