[3.10] gh-94245: Fix pickling and copying of typing.Tuple[()] (GH-94260)

This commit is contained in:
Serhiy Storchaka 2022-06-25 18:45:46 +03:00 committed by GitHub
parent 86e49a5026
commit 75dda3b12d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -1099,7 +1099,8 @@ class _GenericAlias(_BaseGenericAlias, _root=True):
else: else:
origin = self.__origin__ origin = self.__origin__
args = tuple(self.__args__) args = tuple(self.__args__)
if len(args) == 1 and not isinstance(args[0], tuple): if len(args) == 1 and (not isinstance(args[0], tuple) or
origin is Tuple and not args[0]):
args, = args args, = args
return operator.getitem, (origin, args) return operator.getitem, (origin, args)

View file

@ -0,0 +1 @@
Fix pickling and copying of ``typing.Tuple[()]``.