Skip to content

Commit 1b03435

Browse files
committed
pythongh-98374: Suppress ImportError for invalid query for help() command.
1 parent 7b48d02 commit 1b03435

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Lib/pydoc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,11 @@ def help(self, request):
20532053
doc(eval(request), 'Help on %s:')
20542054
elif request in self.keywords: self.showtopic(request)
20552055
elif request in self.topics: self.showtopic(request)
2056-
elif request: doc(request, 'Help on %s:', output=self._output)
2056+
elif request:
2057+
try:
2058+
doc(request, 'Help on %s:', output=self._output)
2059+
except ImportError as e:
2060+
self.output.write(str(e))
20572061
else: doc(str, 'Help on %s:', output=self._output)
20582062
elif isinstance(request, Helper): self()
20592063
else: doc(request, 'Help on %s:', output=self._output)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Suppress ImportError for invalid query for help() command. Patch by Dong-hee
2+
Na.

0 commit comments

Comments
 (0)