-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
Provide NameError/AttributeError suggestions in traceback.py #97008
Comments
cc @cfbolz |
I'm not sure if exact equivalence with suggestions.c is required, but if not, IIRC there was at one point a call to use difflib's get_close_matches(), which might simplify things. |
…eError suggestions Relevant tests moved from test_exceptions to test_traceback to be able to compare both implementations. Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
@sweeneyde the plan is to start from PyPy's implementation, @ambv and I started working on that today (it's a port of Pablo's original commit, at the time I didn't your later changes hadn't landed). |
cc @Yhg1s |
… suggestions (#97022) Relevant tests moved from test_exceptions to test_traceback to be able to compare both implementations. Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
Fixed! |
wonderful, thank you @ambv, @pablogsal and @sweeneyde 😊 |
…eError suggestions (python#97022) Relevant tests moved from test_exceptions to test_traceback to be able to compare both implementations. Co-authored-by: Carl Friedrich Bolz-Tereick <cfbolz@gmx.de>
Python 3.10 added NameError and AttributeError suggestions in raised exceptions, in the form of:
This is implemented in
Python/suggestions.c
and unavailable in the pure Python implementation of traceback formatting inLib/traceback.py
. This makes the output of both different, which is problematic for tooling usingtraceback.py
, as well as for alternative implementations of Python like PyPy and GraalPy.Let's implement the equivalent of
suggestions.c
inLib/traceback.py
to bring both in line.The text was updated successfully, but these errors were encountered: