From f1dd5ed1f35a7ed5c3833c822e9965de2400d77e Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 5 Dec 2021 13:02:47 -0800 Subject: 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 --- Lib/dataclasses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/dataclasses.py') 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] -- cgit v1.2.1