summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan Yanchii <yyanchiy@gmail.com>2024-05-21 16:28:21 (GMT)
committerGitHub <noreply@github.com>2024-05-21 16:28:21 (GMT)
commite03dde5a24d3953e0b16f7cdefdc8b00aa9d9e11 (patch)
treeee632452b43f73adeb7674bc6f7789096fc76017
parent9db2fd7edaa9d03e8c649c3bb0e8d963233cde22 (diff)
downloadcpython-e03dde5a24d3953e0b16f7cdefdc8b00aa9d9e11.zip
cpython-e03dde5a24d3953e0b16f7cdefdc8b00aa9d9e11.tar.gz
cpython-e03dde5a24d3953e0b16f7cdefdc8b00aa9d9e11.tar.bz2
gh-113978: Ignore warnings on text completion inside REPL (#113979)
-rw-r--r--Lib/rlcompleter.py10
-rw-r--r--Misc/NEWS.d/next/Library/2024-01-12-08-51-03.gh-issue-113978.MqTgB0.rst1
2 files changed, 7 insertions, 4 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index 206d6fb..23eb002 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -35,6 +35,7 @@ import inspect
import keyword
import re
import __main__
+import warnings
__all__ = ["Completer"]
@@ -88,10 +89,11 @@ class Completer:
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:
diff --git a/Misc/NEWS.d/next/Library/2024-01-12-08-51-03.gh-issue-113978.MqTgB0.rst b/Misc/NEWS.d/next/Library/2024-01-12-08-51-03.gh-issue-113978.MqTgB0.rst
new file mode 100644
index 0000000..b8f9f25
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-01-12-08-51-03.gh-issue-113978.MqTgB0.rst
@@ -0,0 +1 @@
+Ignore warnings on text completion inside REPL.