-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help
CLI shows a traceback when import failed
#102541
Comments
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 |
How I understand, it's introduced in #89130. |
Yeah, i found right way to fix it. I I have slightly changed signature of some functions, which now have argument help> abd
No Python documentation found for 'abd'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.
help> @terryjreedy What you think about this? |
@terryjreedy |
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 |
@ambv Kirill believes this regression resulted from your #27868. Whichever PR is the cause, CI passed because help() interaction is not adequately tested. Can help Kirill add one to the fix? (AFAIK, not trivial.) This also caused a regression in IDLE, which may or may not be independently fixable. #105689 It would be really nice to fix this before the next releases. |
(cherry picked from commit ba516e7) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Yeah, we have to add the test for interaction. |
Is the only thing left to do here improving test coverage? |
Sadly, but no. When I tried to write a test for this case, I founded another bug. I have already sent PR to fix. |
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. --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
…H-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 0530f4f) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
…H-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 0530f4f) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
) (#106323) 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 0530f4f) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
) (#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 0530f4f) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Okay, so now it's just about adding the last test case, right? 😅 |
Yeah, you're right. |
I reviewed and edited and intend to merge and close this after CI passes. |
Test fix for when one enters, for instance, 'abd' at the 'help>' prompt. --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
…thonGH-106340) Test fix for when one enters, for instance, 'abd' at the 'help>' prompt. --------- (cherry picked from commit 292ac4b) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
…thonGH-106340) Test fix for when one enters, for instance, 'abd' at the 'help>' prompt. --------- (cherry picked from commit 292ac4b) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Thank you very much @terryjreedy for your help! |
…H-106340) (#106640) gh-102541: Add test case for help() for non_existent_module (GH-106340) Test fix for when one enters, for instance, 'abd' at the 'help>' prompt. --------- (cherry picked from commit 292ac4b) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
…H-106340) (#106639) gh-102541: Add test case for help() for non_existent_module (GH-106340) Test fix for when one enters, for instance, 'abd' at the 'help>' prompt. --------- (cherry picked from commit 292ac4b) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Now, all PR's merged and backported. |
Currently,
help
will show a traceback when we type name of something which doesn't exist:I think, this shouldn't be shown.
Is there any reason for this?
Can we show something like
No python documentation found for '123'.
?Reproducible on current main.
Linked PRs
The text was updated successfully, but these errors were encountered: