-
- Notifications
You must be signed in to change notification settings - Fork 33.4k
bpo-44026: Idle get Python's 'did you mean' #25912
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
Conversation
| Pipelines failure is an unrelated |
| AFAICT this PR needs a news entry |
| The pipelines test is a different |
| Perhaps it would be better to use |
I did not know that existed; thanks for pointing me to it! |
| OK, that's the third consecutive pipelines Windows failure of |
| The test you're talking about has failed in lot of PRs recently. |
| Paine, I am currently reviewing and revising, so please no more changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions should only be nested if they need to be. They cannot be tested properly if they are. I expanded the scope slightly to make it more 'complete'. I then reduced the scope of the new tests to testing the new unit, and used subTest to combine and add a 'normal' case.
print_exc should be checked to see if it should be nested. get_message_lines should become get_message. Currently, format_exception_only only returns multiple lines. Combining them could be done within the function. I left that for another issue.
I think this is ready to merge, but am leaving for others and myself to look at again (and, I hope, for someone else to fix the test failures if not done yet).
Current coverage is 54% on my machine. Should update if any other edits.
| Sorry Terry, I know you asked for no more changes, but I need to patch it to correctly deal with multiple errors in a traceback (I will also add a test for this). |
| MacOS failure is an unrelated issue with |
| Sorry, I meant no more changes until I posted my edits, to avoid any merge conflicts. Once I did, I did not merge immediately to allow for further review and possible change. Good thing. In your bad example above, should not the first bad name have been 'abc'? Was 'bcd' a result of fetching sys.exec info again, in get_message_lines, during processing? In any case, with the last patch: Both bad names are listed and corrected. Great. I am impressed by and like the new test, but want to try to improve it and the previous one further. So no changes while I do ;-). (I am assuming that you are not editing right now.) |
terryjreedy left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did edits in comprehensible chunks, testing after each. I will again wait a bit for you to check before merging.
Just checking: is it the parser? |
| Thanks @E-Paine for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9. |
| Sorry, @E-Paine and @terryjreedy, I could not cleanly backport this to |
| GH-25973 is a backport of this pull request to the 3.10 branch. |
…H-25912) A C function accessible by the default exception handler, but not by python code, finds the existing name closest to the name causing a name or attribute error. For such errors, call the default handler after capturing stderr and retrieve its message line. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> (cherry picked from commit 092f9dd)
…ythonGH-25912) A C function accessible by the default exception handler, but not by python code, finds the existing name closest to the name causing a name or attribute error. For such errors, call the default handler after capturing stderr and retrieve its message line. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>. (cherry picked from commit 092f9dd) Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
| GH-25975 is a backport of this pull request to the 3.9 branch. |
A C function accessible by the default exception handler, but not by python code, finds the existing name closest to the name causing a name or attribute error. For such errors, call the default handler after capturing stderr and retrieve its message line. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> (cherry picked from commit 092f9dd) Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
| @E-Paine The conflict was in the idlelib NEWS file. I fixed it and then remembered that this was not be be backported to 3.9 because it does not have the hints. |
| Buildbot failure due to test asyncio deleted. |
Based on the test_exception code included on bpo by @sweeneyde. If the exception is an
AttributeErrororNameError, we remove the last line from the normal traceback and replace it with one captured fromsys.__excepthook__. This implementation utilisestest.support.captured_stderr, like the original.https://bugs.python.org/issue44026