Skip to content

Commit

Permalink
bpo-40181: Remove '/' reminder in IDLE calltips. (GH-22350)
Browse files Browse the repository at this point in the history
The marker was added to the language in 3.8 and
3.7 only gets security patches.
(cherry picked from commit 40a0625)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
  • Loading branch information
miss-islington and terryjreedy committed Sep 22, 2020
1 parent ca2d99d commit 7bcbb53
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Lib/idlelib/NEWS.txt
Expand Up @@ -3,6 +3,9 @@ Released on 2020-09-14?
======================================


bpo-40181: In calltips, stop reminding that '/' marks the end of
positional-only arguments.

bpo-41468: Improve IDLE run crash error message (which users should
never see).

Expand Down
4 changes: 0 additions & 4 deletions Lib/idlelib/calltip.py
Expand Up @@ -118,7 +118,6 @@ def get_entity(expression):
_first_param = re.compile(r'(?<=\()\w*\,?\s*')
_default_callable_argspec = "See source or doc"
_invalid_method = "invalid method signature"
_argument_positional = " # '/' marks preceding args as positional-only."

def get_argspec(ob):
'''Return a string describing the signature of a callable object, or ''.
Expand Down Expand Up @@ -146,9 +145,6 @@ def get_argspec(ob):
else:
argspec = ''

if '/' in argspec and len(argspec) < _MAX_COLS - len(_argument_positional):
# Add explanation TODO remove after 3.7, before 3.9.
argspec += _argument_positional
if isinstance(fob, type) and argspec == '()':
# If fob has no argument, use default callable argspec.
argspec = _default_callable_argspec
Expand Down
8 changes: 3 additions & 5 deletions Lib/idlelib/idle_test/test_calltip.py
Expand Up @@ -61,18 +61,16 @@ class SB: __call__ = None

if List.__doc__ is not None:
tiptest(List,
f'(iterable=(), /){calltip._argument_positional}'
f'(iterable=(), /)'
f'\n{List.__doc__}')
tiptest(list.__new__,
'(*args, **kwargs)\n'
'Create and return a new object. '
'See help(type) for accurate signature.')
tiptest(list.__init__,
'(self, /, *args, **kwargs)'
+ calltip._argument_positional + '\n' +
'(self, /, *args, **kwargs)\n'
'Initialize self. See help(type(self)) for accurate signature.')
append_doc = (calltip._argument_positional
+ "\nAppend object to the end of the list.")
append_doc = "\nAppend object to the end of the list."
tiptest(list.append, '(self, object, /)' + append_doc)
tiptest(List.append, '(self, object, /)' + append_doc)
tiptest([].append, '(object, /)' + append_doc)
Expand Down
@@ -0,0 +1,2 @@
In calltips, stop reminding that '/' marks the end of positional-only
arguments.

0 comments on commit 7bcbb53

Please sign in to comment.