Skip to content

Commit f8e13e3

Browse files
bpo-44752: refactor part of rlcompleter.Completer.attr_matches (GH-27433) (GH-27447)
(cherry picked from commit 6741794) Co-authored-by: Jack DeVries <[email protected]>
1 parent ebba286 commit f8e13e3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Lib/rlcompleter.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,10 @@ def attr_matches(self, text):
186186
# property method, which is not desirable.
187187
matches.append(match)
188188
continue
189-
try:
190-
val = getattr(thisobject, word)
191-
except Exception:
192-
pass # Include even if attribute not set
189+
if (value := getattr(thisobject, word, None)) is not None:
190+
matches.append(self._callable_postfix(value, match))
193191
else:
194-
match = self._callable_postfix(val, match)
195-
matches.append(match)
192+
matches.append(match)
196193
if matches or not noprefix:
197194
break
198195
if noprefix == '_':

0 commit comments

Comments
 (0)