summaryrefslogtreecommitdiffstats
path: root/Lib/rlcompleter.py
diff options
context:
space:
mode:
authorJack DeVries <58614260+jdevries3133@users.noreply.github.com>2021-07-29 14:01:21 (GMT)
committerGitHub <noreply@github.com>2021-07-29 14:01:21 (GMT)
commit6741794dd420c6b9775a188690dbf265037cd69f (patch)
tree5913f6e9e123236b8290ae60fb0cb2bf9e4d1ee7 /Lib/rlcompleter.py
parent50de8f74f8e92b20e76438c22b6a8f91afd6df75 (diff)
downloadcpython-6741794dd420c6b9775a188690dbf265037cd69f.zip
cpython-6741794dd420c6b9775a188690dbf265037cd69f.tar.gz
cpython-6741794dd420c6b9775a188690dbf265037cd69f.tar.bz2
bpo-44752: refactor part of rlcompleter.Completer.attr_matches (GH-27433)
Diffstat (limited to 'Lib/rlcompleter.py')
-rw-r--r--Lib/rlcompleter.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index 34b2599..98b7930 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -186,13 +186,10 @@ class Completer:
# property method, which is not desirable.
matches.append(match)
continue
- try:
- val = getattr(thisobject, word)
- except Exception:
- pass # Include even if attribute not set
+ if (value := getattr(thisobject, word, None)) is not None:
+ matches.append(self._callable_postfix(value, match))
else:
- match = self._callable_postfix(val, match)
- matches.append(match)
+ matches.append(match)
if matches or not noprefix:
break
if noprefix == '_':