mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-45662: Fix the repr of InitVar with a type alias to the built-in class (GH-29291)
For example, InitVar[list[int]].
This commit is contained in:
parent
60c320c38e
commit
1fd4de5bdd
3 changed files with 7 additions and 1 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue