diff options
author | RĂ©mi Lapeyre <remi.lapeyre@lenstra.fr> | 2020-06-30 13:48:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 13:48:15 (GMT) |
commit | bd4a3f21454a6012f4353e2255837561fc9f0e6a (patch) | |
tree | 145feda1b2af2f6e3fec17f0f4cc67e4c34ba390 /Lib/rlcompleter.py | |
parent | 0c4f0f3b29d84063700217dcf90ad6860ed71c70 (diff) | |
download | cpython-bd4a3f21454a6012f4353e2255837561fc9f0e6a.zip cpython-bd4a3f21454a6012f4353e2255837561fc9f0e6a.tar.gz cpython-bd4a3f21454a6012f4353e2255837561fc9f0e6a.tar.bz2 |
bpo-39314: Closes parenthesis when autocompleting for functions that take no arguments (GH-20562)
Diffstat (limited to 'Lib/rlcompleter.py')
-rw-r--r-- | Lib/rlcompleter.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index bca4a7b..c06388e 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -31,6 +31,7 @@ Notes: import atexit import builtins +import inspect import __main__ __all__ = ["Completer"] @@ -96,7 +97,13 @@ class Completer: def _callable_postfix(self, val, word): if callable(val): - word = word + "(" + word += "(" + try: + if not inspect.signature(val).parameters: + word += ")" + except ValueError: + pass + return word def global_matches(self, text): |