diff -r 1e30ecbfe181 Lib/idlelib/CallTips.py --- a/Lib/idlelib/CallTips.py Mon Jun 09 13:32:08 2014 +0300 +++ b/Lib/idlelib/CallTips.py Mon Jun 09 21:59:12 2014 +0300 @@ -184,9 +184,21 @@ defaults = [""] * (len(real_args) - len(defaults)) + defaults items = map(lambda arg, dflt: arg + dflt, real_args, defaults) if fob.func_code.co_flags & 0x4: - items.append("*args") + if 'args' not in real_args: + items.append('*args') + else: + i = 1 + while ('args%s' % i) in real_args: + i += 1 + items.append('*args%s' % i) if fob.func_code.co_flags & 0x8: - items.append("**kwds") + if 'kwargs' not in real_args: + items.append('**kwargs') + else: + i = 1 + while ('kwargs%s' % i) in real_args: + i += 1 + items.append('**kwargs%s' % i) argspec = ", ".join(items) argspec = "(%s)" % re.sub("(?", argspec) diff -r 1e30ecbfe181 Lib/idlelib/idle_test/test_calltips.py --- a/Lib/idlelib/idle_test/test_calltips.py Mon Jun 09 13:32:08 2014 +0300 +++ b/Lib/idlelib/idle_test/test_calltips.py Mon Jun 09 21:59:12 2014 +0300 @@ -22,7 +22,7 @@ def t4(self, *args): 'doc' t4.tip = "(self, *args)" def t5(self, ai, b=None, *args, **kw): 'doc' - t5.tip = "(self, ai, b=None, *args, **kwds)" + t5.tip = "(self, ai, b=None, *args, **kwargs)" def t6(no, self): 'doc' t6.tip = "(no, self)" def __call__(self, ci): 'doc' @@ -104,7 +104,7 @@ def t4(*args): 'doc' t4.tip = "(*args)" def t5(a, b=None, *args, **kwds): 'doc' - t5.tip = "(a, b=None, *args, **kwds)" + t5.tip = "(a, b=None, *args, **kwargs)" for func in (t1, t2, t3, t4, t5, TC): self.assertEqual(signature(func), func.tip + '\ndoc') @@ -126,10 +126,16 @@ class C: def m1(*args): pass def m2(**kwds): pass + def f1(args, kwargs, *a, **k): pass + def f2(args, kwargs, args1, kwargs1, *a, **k): pass c = C() - for meth, mtip in ((C.m1, '(*args)'), (c.m1, "(*args)"), - (C.m2, "(**kwds)"), (c.m2, "(**kwds)"),): - self.assertEqual(signature(meth), mtip) + self.assertEqual(signature(C.m1), '(*args)') + self.assertEqual(signature(c.m1), '(*args)') + self.assertEqual(signature(C.m2), '(**kwargs)') + self.assertEqual(signature(c.m2), '(**kwargs)') + self.assertEqual(signature(f1), '(args, kwargs, *args1, **kwargs1)') + self.assertEqual(signature(f2), + '(args, kwargs, args1, kwargs1, *args2, **kwargs2)') def test_no_docstring(self): def nd(s): pass