[3.12] gh-128615: Cover pickling of ParamSpecArgs and ParamSpecKwargs (GH-128616) (#128626)

Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2025-01-08 13:25:59 +01:00 committed by GitHub
parent b69b9da9b5
commit 4c130c9238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4838,6 +4838,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]): ...