summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2022-10-20 01:56:21 (GMT)
committerGitHub <noreply@github.com>2022-10-20 01:56:21 (GMT)
commit4156b2fc1378531bdd9459cd131fb9fa25a5af34 (patch)
tree0370404fe03cd2e263679546a7dcda23181fb3f5
parent1ca6647f22794f0a0c982ecb03e764db76d51087 (diff)
downloadcpython-4156b2fc1378531bdd9459cd131fb9fa25a5af34.zip
cpython-4156b2fc1378531bdd9459cd131fb9fa25a5af34.tar.gz
cpython-4156b2fc1378531bdd9459cd131fb9fa25a5af34.tar.bz2
gh-98374: Suppress ImportError for invalid query for help() command. (gh-98450)
-rwxr-xr-xLib/pydoc.py5
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-10-19-23-48-46.gh-issue-98374.eOBh8M.rst2
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index a4dc910..c79ec77 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -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
index 0000000..56a41e3
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-10-19-23-48-46.gh-issue-98374.eOBh8M.rst
@@ -0,0 +1,2 @@
+Suppress ImportError for invalid query for help() command. Patch by Dong-hee
+Na.