summaryrefslogtreecommitdiff
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-12-05 13:02:47 -0800
committerGitHub <noreply@github.com>2021-12-05 13:02:47 -0800
commitf1dd5ed1f35a7ed5c3833c822e9965de2400d77e (patch)
tree1fb9173c461a963b846622639fa37e550614e80d /Lib/dataclasses.py
parentbeb834292db54fea129dd073cc822179430cee52 (diff)
downloadcpython-git-f1dd5ed1f35a7ed5c3833c822e9965de2400d77e.tar.gz
bpo-45662: Fix the repr of InitVar with a type alias to the built-in class (GH-29291)
For example, InitVar[list[int]]. (cherry picked from commit 1fd4de5bddbbf2a97cdbac4d298c89e1156bdc6c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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 b3a9194d9d..fe4094b891 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -229,7 +229,7 @@ class InitVar:
self.type = type
def __repr__(self):
- if isinstance(self.type, type):
+ if isinstance(self.type, type) and not isinstance(self.type, GenericAlias):
type_name = self.type.__name__
else:
# typing objects, e.g. List[int]