]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] gh-94245: Fix pickling and copying of typing.Tuple[()] (GH-94260)
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 25 Jun 2022 15:45:46 +0000 (18:45 +0300)
committerGitHub <noreply@github.com>
Sat, 25 Jun 2022 15:45:46 +0000 (18:45 +0300)
Lib/typing.py
Misc/NEWS.d/next/Library/2022-06-25-13-33-18.gh-issue-94245.-zQY1a.rst [new file with mode: 0644]

index 086d0f3f9594c7cb06d197d49af8bb8ee658bf79..9f8710b9f773b8ba8d9d8805303ef60987ed5d64 100644 (file)
@@ -1099,7 +1099,8 @@ class _GenericAlias(_BaseGenericAlias, _root=True):
         else:
             origin = self.__origin__
         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
         return operator.getitem, (origin, args)
 
diff --git a/Misc/NEWS.d/next/Library/2022-06-25-13-33-18.gh-issue-94245.-zQY1a.rst b/Misc/NEWS.d/next/Library/2022-06-25-13-33-18.gh-issue-94245.-zQY1a.rst
new file mode 100644 (file)
index 0000000..de84918
--- /dev/null
@@ -0,0 +1 @@
+Fix pickling and copying of ``typing.Tuple[()]``.