From: Terry Jan Reedy Date: Fri, 26 Jul 2013 22:21:32 +0000 (-0400) Subject: Issue #18539: Calltips now work for float default arguments. X-Git-Tag: v2.7.6rc1~280 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=349065500a0b21c0c296b4fb4b0484f5ac7d35cc;p=thirdparty%2FPython%2Fcpython.git Issue #18539: Calltips now work for float default arguments. --- diff --git a/Lib/idlelib/CallTips.py b/Lib/idlelib/CallTips.py index 0fdef11c6991..c29f89bc0ddd 100644 --- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -163,7 +163,7 @@ def get_arg_text(ob): if fob.func_code.co_flags & 0x8: items.append("***") arg_text = ", ".join(items) - arg_text = "(%s)" % re.sub("\.\d+", "", arg_text) + arg_text = "(%s)" % re.sub("(?", arg_text) # See if we can use the docstring doc = getattr(ob, "__doc__", "") if doc: diff --git a/Lib/idlelib/idle_test/test_calltips.py b/Lib/idlelib/idle_test/test_calltips.py index 1733d392b350..e0f1665fa71f 100644 --- a/Lib/idlelib/idle_test/test_calltips.py +++ b/Lib/idlelib/idle_test/test_calltips.py @@ -10,5 +10,11 @@ class Test_get_entity(unittest.TestCase): def test_good_entity(self): self.assertIs(CTi.get_entity('int'), int) +class Py2Test(unittest.TestCase): + def test_paramtuple_float(self): + # 18539: (a,b) becomes '.0' in code object; change that but not float + def f((a,b), c=0.0): pass + self.assertEqual(ct.get_arg_text(f), '(, c=0.0)') + if __name__ == '__main__': unittest.main(verbosity=2, exit=False) diff --git a/Misc/NEWS b/Misc/NEWS index e02d23d91f6a..251938028889 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -104,6 +104,8 @@ IDLE changed when it has not been changed. This fix followed the addition of a test file originally written by Phil Webster (the issue's main goal). +- Issue #18539: Calltips now work for float default arguments. + - Issue #7136: In the Idle File menu, "New Window" is renamed "New File". Patch by Tal Einat, Roget Serwy, and Todd Rovito.