summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-29 15:44:42 (GMT)
committerGitHub <noreply@github.com>2021-07-29 15:44:42 (GMT)
commitf8e13e35d12bee6e3447c791199522249ba7f05a (patch)
tree47878491162c398ef525e5787a4d599ff5ca7218
parentebba286709bdb9401df8e5eb196b50008d3b09d2 (diff)
downloadcpython-f8e13e35d12bee6e3447c791199522249ba7f05a.zip
cpython-f8e13e35d12bee6e3447c791199522249ba7f05a.tar.gz
cpython-f8e13e35d12bee6e3447c791199522249ba7f05a.tar.bz2
bpo-44752: refactor part of rlcompleter.Completer.attr_matches (GH-27433) (GH-27447)
(cherry picked from commit 6741794dd420c6b9775a188690dbf265037cd69f) Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
-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 == '_':