Bug report
Bug description:
It appears that typing.is_typeddict returns False when called on a specialized TypedDict that is used as a type parameter in a generic TypedDict. This behavior is not documented and seems unexpected.
from typing import is_typeddict, Generic, TypeVar, TypedDict
A = TypeVar("A", bound=TypedDict)
class Attributes(TypedDict):
title: str
class Resource(TypedDict, Generic[A]):
a: A
print(is_typeddict(Resource[Attributes]))
# False (unexpected)
is_typeddict(Resource[Attributes]) should return True, since Resource[...] is still a TypedDict after specialization.
I reported this initially in python/typing#2280 where it was suggested I open an issues here.
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Bug report
Bug description:
It appears that
typing.is_typeddictreturnsFalsewhen called on a specializedTypedDictthat is used as a type parameter in a genericTypedDict. This behavior is not documented and seems unexpected.is_typeddict(Resource[Attributes])should returnTrue, sinceResource[...]is still aTypedDictafter specialization.I reported this initially in python/typing#2280 where it was suggested I open an issues here.
CPython versions tested on:
3.14
Operating systems tested on:
Linux