]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98374: Suppress ImportError for invalid query for help() command. (gh-98450)
authorDong-hee Na <donghee.na@python.org>
Thu, 20 Oct 2022 01:56:21 +0000 (10:56 +0900)
committerGitHub <noreply@github.com>
Thu, 20 Oct 2022 01:56:21 +0000 (10:56 +0900)
Lib/pydoc.py
Misc/NEWS.d/next/Core and Builtins/2022-10-19-23-48-46.gh-issue-98374.eOBh8M.rst [new file with mode: 0644]

index a4dc910c8a8e891cacead6c2f1a138e46cc1fc57..c79ec77a8c09e4aa5dfb84f57a5d4de91759afc4 100755 (executable)
@@ -1997,7 +1997,10 @@ class Helper:
     _GoInteractive = object()
     def __call__(self, request=_GoInteractive):
         if request is not self._GoInteractive:
-            self.help(request)
+            try:
+                self.help(request)
+            except ImportError as e:
+                self.output.write(f'{e}\n')
         else:
             self.intro()
             self.interact()
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-10-19-23-48-46.gh-issue-98374.eOBh8M.rst b/Misc/NEWS.d/next/Core and Builtins/2022-10-19-23-48-46.gh-issue-98374.eOBh8M.rst
new file mode 100644 (file)
index 0000000..56a41e3
--- /dev/null
@@ -0,0 +1,2 @@
+Suppress ImportError for invalid query for help() command. Patch by Dong-hee
+Na.