diff -r a444464a2e87 Lib/inspect.py --- a/Lib/inspect.py Thu May 14 18:47:17 2015 -0400 +++ b/Lib/inspect.py Fri May 15 09:55:25 2015 +0300 @@ -2461,11 +2461,9 @@ class BoundArguments: return {'_signature': self._signature, 'arguments': self.arguments} def __repr__(self): - args = [] - for arg, value in self.arguments.items(): - args.append('{}={!r}'.format(arg, value)) - return '<{} at {:#x} ({})>'.format(self.__class__.__name__, - id(self), ', '.join(args)) + args = [repr(value) for value in self.args] + args += ['%s=%r' % (name, value) for name, value in self.kwargs.items()] + return '<%s (%s)>' % (self.__class__.__name__, ', '.join(args)) class Signature: diff -r a444464a2e87 Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py Thu May 14 18:47:17 2015 -0400 +++ b/Lib/test/test_inspect.py Fri May 15 09:55:25 2015 +0300 @@ -3150,11 +3150,14 @@ class TestBoundArguments(unittest.TestCa self.assertEqual(ba, ba_pickled) def test_signature_bound_arguments_repr(self): - def foo(a, b, *, c:1={}, **kw) -> {42:'ham'}: pass + def foo(a, b, *args, c:1={}, **kw) -> {42:'ham'}: pass sig = inspect.signature(foo) - ba = sig.bind(20, 30, z={}) - self.assertRegex(repr(ba), - r'') + self.assertEqual(repr(sig.bind(20, 30)), + '') + self.assertEqual(repr(sig.bind(20, 30, c=[])), + '') + self.assertEqual(repr(sig.bind(20, 30, 40, 50, z={})), + '') class TestSignaturePrivateHelpers(unittest.TestCase):