python / cpython

The Python programming language
https://www.python.org
Other
63.37k stars 30.33k forks source link

IDLE: calltips not properly formatted for functions without doc-strings #79822

Closed taleinat closed 5 years ago

taleinat commented 5 years ago
BPO 35641
Nosy @terryjreedy, @taleinat, @mr-nfamous, @eamanu, @miss-islington
PRs
  • python/cpython#11415
  • python/cpython#11420
  • python/cpython#11479
  • python/cpython#11480
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['easy', '3.8', 'expert-IDLE', 'type-bug', '3.7'] title = 'IDLE: calltips not properly formatted for functions without doc-strings' updated_at = user = 'https://github.com/taleinat' ``` bugs.python.org fields: ```python activity = actor = 'terry.reedy' assignee = 'none' closed = True closed_date = closer = 'taleinat' components = ['IDLE'] creation = creator = 'taleinat' dependencies = [] files = [] hgrepos = [] issue_num = 35641 keywords = ['patch', 'patch', 'patch', 'patch', 'easy'] message_count = 8.0 messages = ['332882', '332885', '332886', '332917', '332925', '332926', '333326', '333328'] nosy_count = 5.0 nosy_names = ['terry.reedy', 'taleinat', 'bup', 'eamanu', 'miss-islington'] pr_nums = ['11415', '11420', '11479', '11480'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue35641' versions = ['Python 3.7', 'Python 3.8'] ```

    taleinat commented 5 years ago

    IDLE usually wraps call-tips to 85 characters. However, for functions without a doc-string, this formatting is skipped. This is an issue for functions with long signatures, e.g. due to having many arguments or due to having default values with long repr-s.

    This appears to be caused by line 170 in Lib/idlelib/calltip.py being indented once too much. (see: https://github.com/python/cpython/blob/87e59ac11ee074b0dc1bc864c74fac0660b27f6e/Lib/idlelib/calltip.py)

    Thanks to Dan Snider for the original report in msg332881 on issue bpo-35196.

    Example:

    >>> def foo(s='a'*100):
        pass
    
    >>> print(get_argspec(foo))
    (s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
    
    >>> def bar(s='a'*100):
        """doc-string"""
        pass
    
    >>> print(get_argspec(bar))
    (s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
        aaaaaaaaaaaaaaaaaaa')
    doc-string
    taleinat commented 5 years ago

    I'm marking this as easy.

    Whoever works on this should make sure to add a new test case for this bug.

    1220ddd9-1292-49f3-b2d8-3f0384085267 commented 5 years ago

    Hi Tal Einat!

    I would like to take this issue to be my first contribution :-)

    Thanks!

    terryjreedy commented 5 years ago

    New changeset ab54b9a130c88f708077c2ef6c4963b632c132b3 by Terry Jan Reedy (Emmanuel Arias) in branch 'master': bpo-35641: IDLE - format calltip properly when no docstring (GH-11415) https://github.com/python/cpython/commit/ab54b9a130c88f708077c2ef6c4963b632c132b3

    miss-islington commented 5 years ago

    New changeset 3c83cb7eed4f0e8b9f1cbf39263a2053a2483cb0 by Miss Islington (bot) in branch '3.7': bpo-35641: IDLE - format calltip properly when no docstring (GH-11415) https://github.com/python/cpython/commit/3c83cb7eed4f0e8b9f1cbf39263a2053a2483cb0

    taleinat commented 5 years ago

    Thanks for the report, Dan!

    Thanks for the fix, Emmanuel!

    terryjreedy commented 5 years ago

    New changeset ee6559436797032b816dfb8c6376c9a451014962 by Terry Jan Reedy in branch 'master': bpo-35641: Move IDLE blurb to IDLE directory (bpo-11479) https://github.com/python/cpython/commit/ee6559436797032b816dfb8c6376c9a451014962

    miss-islington commented 5 years ago

    New changeset 6f76ef81596bbd885957b7fea3f40024ed9d6797 by Miss Islington (bot) in branch '3.7': bpo-35641: Move IDLE blurb to IDLE directory (GH-11479) https://github.com/python/cpython/commit/6f76ef81596bbd885957b7fea3f40024ed9d6797