gh-89547: Support for nesting special forms like Final (#116096)

This commit is contained in:
Mehdi Drissi 2024-03-11 23:11:56 -07:00 committed by GitHub
parent 4fa95c6ec3
commit d308d33e09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 14 deletions

View file

@ -653,7 +653,7 @@ def ClassVar(self, parameters):
Note that ClassVar is not a class itself, and should not
be used with isinstance() or issubclass().
"""
item = _type_check(parameters, f'{self} accepts only single type.')
item = _type_check(parameters, f'{self} accepts only single type.', allow_special_forms=True)
return _GenericAlias(self, (item,))
@_SpecialForm
@ -675,7 +675,7 @@ def Final(self, parameters):
There is no runtime checking of these properties.
"""
item = _type_check(parameters, f'{self} accepts only single type.')
item = _type_check(parameters, f'{self} accepts only single type.', allow_special_forms=True)
return _GenericAlias(self, (item,))
@_SpecialForm