]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-113978: Ignore warnings on text completion inside REPL (GH-113979) (#119429)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 22 May 2024 21:13:32 +0000 (23:13 +0200)
committerGitHub <noreply@github.com>
Wed, 22 May 2024 21:13:32 +0000 (23:13 +0200)
(cherry picked from commit e03dde5a24d3953e0b16f7cdefdc8b00aa9d9e11)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Lib/rlcompleter.py
Misc/NEWS.d/next/Library/2024-01-12-08-51-03.gh-issue-113978.MqTgB0.rst [new file with mode: 0644]

index 206d6fb511cdf61c8551b5c608b1c55229f1880e..23eb0020f42e8a01486d03cd980f490e15ef3a52 100644 (file)
@@ -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 (file)
index 0000000..b8f9f25
--- /dev/null
@@ -0,0 +1 @@
+Ignore warnings on text completion inside REPL.