mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
gh-89547: Support for nesting special forms like Final (#116096)
This commit is contained in:
parent
4fa95c6ec3
commit
d308d33e09
4 changed files with 32 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue