From a0f3d0ed83461fadac0a13bab0eb404eb416e21a Mon Sep 17 00:00:00 2001 From: Denis Laxalde Date: Wed, 12 Jan 2022 13:54:43 +0100 Subject: [PATCH] bpo-46353: Fix "pydoc -k" when a module fails to load The 'spec' value, here coming from pkgutil._get_spec(), may be None because .find_module() may return None. We account for this in pydoc's ModuleScanner and skip such modules scan. --- Lib/pydoc.py | 2 ++ .../next/Library/2022-01-12-14-10-42.bpo-46353.wSHF5T.rst | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2022-01-12-14-10-42.bpo-46353.wSHF5T.rst diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 7d52359c9a0ce9..4014a2f54a5549 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -2230,6 +2230,8 @@ def run(self, callback, key=None, completer=None, onerror=None): except SyntaxError: # raised by tests for bad coding cookies or BOM continue + if spec is None: + continue loader = spec.loader if hasattr(loader, 'get_source'): try: diff --git a/Misc/NEWS.d/next/Library/2022-01-12-14-10-42.bpo-46353.wSHF5T.rst b/Misc/NEWS.d/next/Library/2022-01-12-14-10-42.bpo-46353.wSHF5T.rst new file mode 100644 index 00000000000000..cfc77f35318325 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-12-14-10-42.bpo-46353.wSHF5T.rst @@ -0,0 +1,2 @@ +Skip scan of modules that fail to load during keyword search in +:mod:`pydoc`. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy