This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: is_dataclass() does not work for dataclasses which are subclasses of types.GenericAlias
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, gvanrossum, miss-islington, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2021-10-28 20:10 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29294 merged serhiy.storchaka, 2021-10-28 20:14
PR 29925 merged miss-islington, 2021-12-05 20:42
PR 29926 merged miss-islington, 2021-12-05 20:43
Messages (4)
msg405256 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-10-28 20:10
>>> 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
msg407739 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-12-05 20:42
New changeset 446be166861b2f08f87f74018113dd98ca5fca02 by Serhiy Storchaka in branch 'main':
bpo-45663: Fix is_dataclass() for dataclasses which are subclasses of types.GenericAlias (GH-29294)
https://github.com/python/cpython/commit/446be166861b2f08f87f74018113dd98ca5fca02
msg407743 - (view) Author: miss-islington (miss-islington) Date: 2021-12-05 21:04
New changeset abceb66c7e33d165361d8a26efb3770faa721aff by Miss Islington (bot) in branch '3.10':
bpo-45663: Fix is_dataclass() for dataclasses which are subclasses of types.GenericAlias (GH-29294)
https://github.com/python/cpython/commit/abceb66c7e33d165361d8a26efb3770faa721aff
msg407745 - (view) Author: miss-islington (miss-islington) Date: 2021-12-05 21:25
New changeset 19050711f5a68e50b942b3b7f1f4cf398f27efff by Miss Islington (bot) in branch '3.9':
bpo-45663: Fix is_dataclass() for dataclasses which are subclasses of types.GenericAlias (GH-29294)
https://github.com/python/cpython/commit/19050711f5a68e50b942b3b7f1f4cf398f27efff
History
Date User Action Args
2022-04-11 14:59:51adminsetgithub: 89826
2021-12-07 12:01:12serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-12-05 21:25:54miss-islingtonsetmessages: + msg407745
2021-12-05 21:04:37miss-islingtonsetmessages: + msg407743
2021-12-05 20:43:01miss-islingtonsetpull_requests: + pull_request28150
2021-12-05 20:42:57miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request28149
2021-12-05 20:42:54serhiy.storchakasetmessages: + msg407739
2021-10-29 08:41:23serhiy.storchakalinkissue45665 dependencies
2021-10-28 20:14:25serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request27557
2021-10-28 20:10:31serhiy.storchakacreate