From e55c13a61278dbc833156ac0d4c1094ddd8e7528 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Thu, 9 Jan 2025 14:00:54 -0800 Subject: [PATCH] update allowlist comment for SupportsAbs and SupportsRound (#13380) The answer to the question is that mypy infers it just fine, but stubtest doesn't check for attributes inherited from the metaclass because that's almost never what we want. In this case, the runtime implementation doesn't get __type_params__ from builtins.type either. It's actually defined for the class due to the use of PEP-695 syntax. --- stdlib/@tests/stubtest_allowlists/py312.txt | 3 +-- stdlib/@tests/stubtest_allowlists/py313.txt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py312.txt b/stdlib/@tests/stubtest_allowlists/py312.txt index c2b216e58..6d5a4ca98 100644 --- a/stdlib/@tests/stubtest_allowlists/py312.txt +++ b/stdlib/@tests/stubtest_allowlists/py312.txt @@ -136,8 +136,7 @@ typing.ParamSpecKwargs.__mro_entries__ typing.TypeVar.__mro_entries__ typing.TypeVarTuple.__mro_entries__ -# TODO: mypy should infer that this attribute is inherited from builtins.type; -# why doesn't it infer this? +# These exist at runtime because the protocol uses PEP-695 syntax in CPython typing.SupportsAbs.__type_params__ typing.SupportsRound.__type_params__ typing_extensions.SupportsAbs.__type_params__ diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index 57fa5d26a..bb8fc6f6d 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -126,8 +126,7 @@ typing.ParamSpecKwargs.__mro_entries__ typing.TypeVar.__mro_entries__ typing.TypeVarTuple.__mro_entries__ -# TODO: mypy should infer that this attribute is inherited from builtins.type; -# why doesn't it infer this? +# These exist at runtime because the protocol uses PEP-695 syntax in CPython typing.SupportsAbs.__type_params__ typing.SupportsRound.__type_params__ typing_extensions.SupportsAbs.__type_params__