diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-12-05 13:02:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-05 13:02:47 -0800 |
commit | f1dd5ed1f35a7ed5c3833c822e9965de2400d77e (patch) | |
tree | 1fb9173c461a963b846622639fa37e550614e80d /Lib/dataclasses.py | |
parent | beb834292db54fea129dd073cc822179430cee52 (diff) | |
download | cpython-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.py | 2 |
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] |