mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-89828: Do not relay the __class__ attribute in GenericAlias (GH-93754)
list[int].__class__ returned type, and isinstance(list[int], type)
returned True. It caused numerous problems in code that checks
isinstance(x, type).
(cherry picked from commit f9433fff47
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
2eff55cd46
commit
579e985e75
7 changed files with 18 additions and 20 deletions
|
@ -1079,7 +1079,7 @@ class TypeVarTuple(_Final, _Immutable, _PickleUsingNameMixin, _root=True):
|
|||
var_tuple_index = None
|
||||
fillarg = None
|
||||
for k, arg in enumerate(args):
|
||||
if not (isinstance(arg, type) and not isinstance(arg, GenericAlias)):
|
||||
if not isinstance(arg, type):
|
||||
subargs = getattr(arg, '__typing_unpacked_tuple_args__', None)
|
||||
if subargs and len(subargs) == 2 and subargs[-1] is ...:
|
||||
if var_tuple_index is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue