From e2af980e19794adb36647396c74a7e5aa96ba90e Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Thu, 20 Oct 2022 11:43:21 +0900 Subject: =?UTF-8?q?[3.11]=20gh-98374:=20Suppress=20ImportError=20for=20inv?= =?UTF-8?q?alid=20query=20for=20help()=20co=E2=80=A6=20(gh-98472)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lib/pydoc.py | 5 ++++- .../Core and Builtins/2022-10-19-23-48-46.gh-issue-98374.eOBh8M.rst | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2022-10-19-23-48-46.gh-issue-98374.eOBh8M.rst 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() 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. -- cgit v0.12