Skip to content

Commit 697e1fc

Browse files
committed
[3.11] pythongh-98374: Suppress ImportError for invalid query for help() command. (pythongh-98450)
(cherry picked from commit 4156b2f) Co-authored-by: Dong-hee Na <donghee.na@python.org>
1 parent 5f5fa4c commit 697e1fc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/pydoc.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,10 @@ def __repr__(self):
19981998
_GoInteractive = object()
19991999
def __call__(self, request=_GoInteractive):
20002000
if request is not self._GoInteractive:
2001-
self.help(request)
2001+
try:
2002+
self.help(request)
2003+
except ImportError as e:
2004+
self.output.write(f'{e}\n')
20022005
else:
20032006
self.intro()
20042007
self.interact()
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)