Skip to content

Commit

Permalink
pythongh-113978: Ignore warnings on text completion inside REPL (pyth…
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframAlph authored May 21, 2024
1 parent 9db2fd7 commit e03dde5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Lib/rlcompleter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import keyword
import re
import __main__
import warnings

__all__ = ["Completer"]

Expand Down Expand Up @@ -88,10 +89,11 @@ def complete(self, text, state):
return None

if state == 0:
if "." in text:
self.matches = self.attr_matches(text)
else:
self.matches = self.global_matches(text)
with warnings.catch_warnings(action="ignore"):
if "." in text:
self.matches = self.attr_matches(text)
else:
self.matches = self.global_matches(text)
try:
return self.matches[state]
except IndexError:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ignore warnings on text completion inside REPL.

0 comments on commit e03dde5

Please sign in to comment.