diff options
author | Dong-hee Na <donghee.na@python.org> | 2022-10-20 02:43:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-20 02:43:21 (GMT) |
commit | e2af980e19794adb36647396c74a7e5aa96ba90e (patch) | |
tree | b11dd7e71e1bc2e2530d54feda485c3aeae54f8a /Lib/pydoc.py | |
parent | 5f5fa4ca4b959f5e86fe141e297fd8b93eaeabff (diff) | |
download | cpython-e2af980e19794adb36647396c74a7e5aa96ba90e.zip cpython-e2af980e19794adb36647396c74a7e5aa96ba90e.tar.gz cpython-e2af980e19794adb36647396c74a7e5aa96ba90e.tar.bz2 |
[3.11] gh-98374: Suppress ImportError for invalid query for help() co… (gh-98472)
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 4343166..088a3ba 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1998,7 +1998,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() |