mirror of
https://github.com/python/cpython.git
synced 2025-09-25 17:59:57 +00:00
[3.12] gh-102541: Fix Helper.help("mod") for non-existent mod (GH-105934) (#106322)
gh-102541: Fix Helper.help("mod") for non-existent mod (GH-105934)
If the output arg to Helper() is a stream rather than the default None, which means 'page to stdout', the ImportError from pydoc.resolve is currently not caught in pydoc.doc. The same error is caught when output is None.
---------
(cherry picked from commit 0530f4f646
)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
8738c5bcee
commit
730c873efd
3 changed files with 13 additions and 1 deletions
|
@ -1790,7 +1790,11 @@ def doc(thing, title='Python Library Documentation: %s', forceload=0,
|
|||
raise
|
||||
print(exc)
|
||||
else:
|
||||
output.write(render_doc(thing, title, forceload, plaintext))
|
||||
try:
|
||||
s = render_doc(thing, title, forceload, plaintext)
|
||||
except ImportError as exc:
|
||||
s = str(exc)
|
||||
output.write(s)
|
||||
|
||||
def writedoc(thing, forceload=0):
|
||||
"""Write HTML documentation to a file in the current directory."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue