From e2af980e19794adb36647396c74a7e5aa96ba90e Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Thu, 20 Oct 2022 11:43:21 +0900 Subject: [PATCH] =?utf8?q?[3.11]=20gh-98374:=20Suppress=20ImportError=20fo?= =?utf8?q?r=20invalid=20query=20for=20help()=20co=E2=80=A6=20(gh-98472)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Lib/pydoc.py | 5 ++++- .../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 434316635d48..088a3ba8817c 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 000000000000..56a41e3883d1 --- /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. -- 2.47.3