Skip to content

Commit 8466abc

Browse files
committed
fix(Lib/rlcompleter): prevent suggesting non-existent attributes
1 parent a15aeec commit 8466abc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/rlcompleter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ def attr_matches(self, text):
191191
if (value := getattr(thisobject, word, None)) is not None:
192192
matches.append(self._callable_postfix(value, match))
193193
else:
194-
matches.append(match)
194+
if hasattr(thisobject, word):
195+
matches.append(match)
195196
if matches or not noprefix:
196197
break
197198
if noprefix == '_':

0 commit comments

Comments
 (0)