Skip to content

Conversation

mauricioharley
Copy link

Summary

  • Pipes the raw exception through traceback.format_exception_only so the attribute/name error suggestions introduced in Python 3.10 (issue NameError/AttributeError suggestions in Python 3.10 error messages #13445) reach the final themed traceback.
  • Preserves additional suggestion lines and PEP-678 notes while rendering.
  • Adds regression tests that verify IPython now matches CPython’s messages for both attribute and name errors on Python ≥3.10.

Fixes #13445

* Reuses traceback.format_exception_only when formatting exceptions so the CPython 3.10+ “Did you mean …” hints requested in ipython#13445 appear in IPython output.
* Accepts the real exception type, keep multi-line suggestion lines, and still append any PEP-678 notes for the message.
* Adds helper-driven regression tests that compare IPython’s traceback output against CPython for attribute/name errors on Python ≥3.10.

Fixes ipython#13445

Signed-off-by: Mauricio Harley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NameError/AttributeError suggestions in Python 3.10 error messages

1 participant