]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-128615: Cover pickling of `ParamSpecArgs` and `ParamSpecKwargs` (GH-128616...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 8 Jan 2025 12:32:32 +0000 (13:32 +0100)
committerGitHub <noreply@github.com>
Wed, 8 Jan 2025 12:32:32 +0000 (12:32 +0000)
gh-128615: Cover pickling of `ParamSpecArgs` and `ParamSpecKwargs` (GH-128616)
(cherry picked from commit 74a517181a9bb65a1f6da149af7427a9fcb3add3)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_typing.py

index cf0406faf1167098291887fcb002d6dc2c854e5f..140ceb747355705306d3edcbb51bab94dcc5365a 100644 (file)
@@ -5177,6 +5177,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]): ...