| 
6 | 6 | from itertools import permutations  | 
7 | 7 | import pickle  | 
8 | 8 | from random import choice  | 
 | 9 | +import re  | 
9 | 10 | import sys  | 
10 | 11 | from test import support  | 
11 | 12 | import threading  | 
@@ -361,16 +362,16 @@ def test_setstate(self):  | 
361 | 362 |         f = self.partial(signature)  | 
362 | 363 |         f.__setstate__((capture, (PH, 1), dict(a=10), dict(attr=[])))  | 
363 | 364 |         self.assertEqual(signature(f), (capture, (PH, 1), dict(a=10), dict(attr=[])))  | 
364 |  | -        msg_regex = ("^missing positional arguments in 'partial' call; "  | 
365 |  | -                     "expected at least 1, got 0$")  | 
366 |  | -        with self.assertRaisesRegex(TypeError, msg_regex) as cm:  | 
 | 365 | +        msg_regex = re.escape("missing positional arguments in 'partial' call; "  | 
 | 366 | +                              "expected at least 1, got 0")  | 
 | 367 | +        with self.assertRaisesRegex(TypeError, f'^{msg_regex}$') as cm:  | 
367 | 368 |             f()  | 
368 | 369 |         self.assertEqual(f(2), ((2, 1), dict(a=10)))  | 
369 | 370 | 
 
  | 
370 | 371 |         # Trailing Placeholder error  | 
371 | 372 |         f = self.partial(signature)  | 
372 |  | -        msg_regex = "^trailing Placeholders are not allowed$"  | 
373 |  | -        with self.assertRaisesRegex(TypeError, msg_regex) as cm:  | 
 | 373 | +        msg_regex = re.escape("trailing Placeholders are not allowed")  | 
 | 374 | +        with self.assertRaisesRegex(TypeError, f'^{msg_regex}$') as cm:  | 
374 | 375 |             f.__setstate__((capture, (1, PH), dict(a=10), dict(attr=[])))  | 
375 | 376 | 
 
  | 
376 | 377 |     def test_setstate_errors(self):  | 
 | 
0 commit comments