summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-12-05 20:42:50 (GMT)
committerGitHub <noreply@github.com>2021-12-05 20:42:50 (GMT)
commit446be166861b2f08f87f74018113dd98ca5fca02 (patch)
tree72eed67ccf609faefac71afa67589866a3818843 /Lib/dataclasses.py
parent1fd4de5bddbbf2a97cdbac4d298c89e1156bdc6c (diff)
downloadcpython-446be166861b2f08f87f74018113dd98ca5fca02.zip
cpython-446be166861b2f08f87f74018113dd98ca5fca02.tar.gz
cpython-446be166861b2f08f87f74018113dd98ca5fca02.tar.bz2
bpo-45663: Fix is_dataclass() for dataclasses which are subclasses of types.GenericAlias (GH-29294)
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r--Lib/dataclasses.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index da06aa6..3f85d85 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -1211,7 +1211,7 @@ def _is_dataclass_instance(obj):
def is_dataclass(obj):
"""Returns True if obj is a dataclass or an instance of a
dataclass."""
- cls = obj if isinstance(obj, type) else type(obj)
+ cls = obj if isinstance(obj, type) and not isinstance(obj, GenericAlias) else type(obj)
return hasattr(cls, _FIELDS)