Skip to content

Commit

Permalink
[3.13] gh-113978: Ignore warnings on text completion inside REPL (GH-…
Browse files Browse the repository at this point in the history
…113979) (#119429)

(cherry picked from commit e03dde5)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
  • Loading branch information
miss-islington and WolframAlph committed May 22, 2024
1 parent e6e4efc commit 6bc7fc0
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 6bc7fc0

Please sign in to comment.