You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
help CLI shows a traceback when import failed #102541
Currently, help will show a traceback when we type name of something which doesn't exist:
help>123Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"<frozen _sitebuiltins>", line103, in__call__File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line2004, in__call__self.interact()
File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line2031, ininteractself.help(request)
File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line2057, inhelpelifrequest: doc(request, 'Help on %s:', output=self._output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line1781, indocpager(render_doc(thing, title, forceload))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line1755, inrender_docobject, name=resolve(thing, forceload)
^^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line1741, inresolveraiseImportError('''\
ImportError: No Python documentation found for '123'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.
>>>
I think, this shouldn't be shown.
Is there any reason for this?
Can we show something like No python documentation found for '123'.?
I verified above in 3.11.2 and 3.12.0a6. 3.10.10 is better -- Gives import error message without traceback. But even better would be to give error message without ImportError and return to help> prompt. This should possibly be a separate PR as there might be more discussion that change. (It is possible that 3.11 change is intentional -- this should be checked.)
Yeah, i found right way to fix it. I I have slightly changed signature of some functions, which now have argument is_cli (set default to False).
That's doesn't break compatibility with issue which i mentioned above.
Currenly, in help prompt errors looks like that:
@terryjreedy What you think about this?
BTW, all tests are passed.
I think, error message we should change, any ideas? (this will make us to change some lines in test_pydoc, but it's not hard)
In closed duplicate #105702, I noted that there was no bug in latest release of 3.8, 3.9, or 3.10. Patch should restore previous behavior, shown on that issue, which is same as shown above. I just installed 32-bit 3.11.0 and it does have the bug. Will look at PR.
In closed duplicate #105702, I noted that there was no bug in latest release of 3.8, 3.9, or 3.10. Patch should restore previous behavior, shown on that issue, which is same as shown above. I just installed 32-bit 3.11.0 and it does have the bug. Will look at PR.
Yeah, so, please, delete label 3.10 on this issue, and add 3.13 label, this still reproducible on current main
Activity
terryjreedy commentedon Mar 8, 2023
I verified above in 3.11.2 and 3.12.0a6. 3.10.10 is better -- Gives import error message without traceback. But even better would be to give error message without
ImportErrorand return tohelp>prompt. This should possibly be a separate PR as there might be more discussion that change. (It is possible that 3.11 change is intentional -- this should be checked.)Eclips4 commentedon Mar 8, 2023
How I understand, it's introduced in #89130.
Eclips4 commentedon Mar 9, 2023
Yeah, i found right way to fix it. I I have slightly changed signature of some functions, which now have argument
is_cli(set default toFalse).That's doesn't break compatibility with issue which i mentioned above.
Currenly, in
helpprompt errors looks like that:@terryjreedy What you think about this?
BTW, all tests are passed.
I think, error message we should change, any ideas? (this will make us to change some lines in
test_pydoc, but it's not hard)pythongh-102541: Hide traceback in help prompt
Eclips4 commentedon Jun 12, 2023
@terryjreedy
I think there's no need to backport it to 3.10 branch. I cannot reproduce it there
terryjreedy commentedon Jun 12, 2023
In closed duplicate #105702, I noted that there was no bug in latest release of 3.8, 3.9, or 3.10. Patch should restore previous behavior, shown on that issue, which is same as shown above. I just installed 32-bit 3.11.0 and it does have the bug. Will look at PR.
Eclips4 commentedon Jun 12, 2023
Yeah, so, please, delete label
3.10on this issue, and add 3.13 label, this still reproducible on current main21 remaining items
[3.11] gh-102541: Fix Helper.help("mod") for non-existent mod (GH-105934
[3.12] gh-102541: Fix Helper.help("mod") for non-existent mod (GH-105934
terryjreedy commentedon Jul 2, 2023
This issue is at least a near duplicate of issue #98374 and PR #98450, about
help('invalid'), closed and merged.@Eclips4 The 2nd fix is now merged and backported. Can you now write a test for the first one?
pythongh-102541: Add test case for `Helper.help('module')` for non-ex…
Yhg1s commentedon Jul 11, 2023
Okay, so now it's just about adding the last test case, right? 😅
Eclips4 commentedon Jul 11, 2023
Yeah, you're right.
I already sent a PR to add this, and waiting for review.
terryjreedy commentedon Jul 11, 2023
I reviewed and edited and intend to merge and close this after CI passes.
gh-102541: Add test case for help() for non_existent_module (#106340)
pythongh-102541: Add test case for help() for non_existent_module (py…
pythongh-102541: Add test case for help() for non_existent_module (py…
Eclips4 commentedon Jul 11, 2023
Thank you very much @terryjreedy for your help!
[3.11] gh-102541: Add test case for help() for non_existent_module (G…
[3.12] gh-102541: Add test case for help() for non_existent_module (G…
Eclips4 commentedon Jul 11, 2023
Now, all PR's merged and backported.
Everything that needed to be done was done.
Again, thanks Terry for his thorough help.