]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128615: Cover pickling of `ParamSpecArgs` and `ParamSpecKwargs` (#128616)
authorsobolevn <mail@sobolevn.me>
Wed, 8 Jan 2025 12:04:54 +0000 (15:04 +0300)
committerGitHub <noreply@github.com>
Wed, 8 Jan 2025 12:04:54 +0000 (15:04 +0300)
Lib/test/test_typing.py

index a75dac4a6102bf98338dc0efce469fb577a5c0f7..45ba7611059e43707c0a5638228a2e886450bc4d 100644 (file)
@@ -5182,6 +5182,18 @@ class GenericTests(BaseTestCase):
                 x = pickle.loads(z)
                 self.assertEqual(s, x)
 
+        # Test ParamSpec args and kwargs
+        global PP
+        PP = ParamSpec('PP')
+        for thing in [PP.args, PP.kwargs]:
+            for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+                with self.subTest(thing=thing, proto=proto):
+                    self.assertEqual(
+                        pickle.loads(pickle.dumps(thing, proto)),
+                        thing,
+                    )
+        del PP
+
     def test_copy_and_deepcopy(self):
         T = TypeVar('T')
         class Node(Generic[T]): ...