Skip to content

Commit

Permalink
pythongh-113978: Ignore warnings on text completion inside REPL
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframAlph committed Jan 12, 2024
1 parent e58334e commit 7fe3c23
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 7fe3c23

Please sign in to comment.