aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2022-10-20 10:56:21 +0900
committerGitHub <noreply@github.com>2022-10-20 10:56:21 +0900
commit4156b2fc1378531bdd9459cd131fb9fa25a5af34 (patch)
tree0370404fe03cd2e263679546a7dcda23181fb3f5 /Lib/pydoc.py
parent1ca6647f22794f0a0c982ecb03e764db76d51087 (diff)
downloadcpython-4156b2fc1378531bdd9459cd131fb9fa25a5af34.tar.gz
cpython-4156b2fc1378531bdd9459cd131fb9fa25a5af34.zip
gh-98374: Suppress ImportError for invalid query for help() command. (gh-98450)
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index a4dc910c8a8..c79ec77a8c0 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()