[New-bugs-announce] [issue45663] is_dataclass() does not work for dataclasses which are subclasses of types.GenericAlias

Serhiy Storchaka report at bugs.python.org
Thu Oct 28 16:10:31 EDT 2021


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

>>> import dataclasses, types
>>> @dataclasses.dataclass
... class A(types.GenericAlias):
...     origin: type
...     args: type
... 
>>> dataclasses.is_dataclass(A)
True
>>> a = A(list, int)
>>> dataclasses.is_dataclass(type(a))
True
>>> dataclasses.is_dataclass(a)
False

----------
components: Library (Lib)
messages: 405256
nosy: eric.smith, gvanrossum, serhiy.storchaka
priority: normal
severity: normal
status: open
title: is_dataclass() does not work for dataclasses which are subclasses of types.GenericAlias
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45663>
_______________________________________


More information about the New-bugs-announce mailing list