Skip to content

fix: surface Python 3.10+ NameError/AttributeError suggestions in REPL#15227

Draft
Aanushka001 wants to merge 5 commits into
ipython:mainfrom
Aanushka001:fix/nameerror-suggestions
Draft

fix: surface Python 3.10+ NameError/AttributeError suggestions in REPL#15227
Aanushka001 wants to merge 5 commits into
ipython:mainfrom
Aanushka001:fix/nameerror-suggestions

Conversation

@Aanushka001

Copy link
Copy Markdown

This PR adds support for Python 3.10+'s "Did you mean...?" suggestions for NameError and AttributeError exceptions in IPython's REPL traceback formatting.

Changes

  • Added get_suggestions() method to VerboseTB in IPython/core/ultratb.py that captures Python 3.10+ suggestion hints using sys.__excepthook__ with redirect_stderr
  • Modified format_exception_as_a_whole() to include the suggestion text in the formatted output with proper theming
  • The method checks for NameError/AttributeError exceptions on Python 3.10+ and uses the __excepthook__ to generate suggestions, parsing the stderr output for "Did you mean" lines

Closes #13445

@Aanushka001

This comment was marked as off-topic.

@Aanushka001

This comment was marked as off-topic.

@Aanushka001

This comment was marked as off-topic.

@Aanushka001

This comment was marked as off-topic.

@Aanushka001 Aanushka001 force-pushed the fix/nameerror-suggestions branch from f88a35f to 2261300 Compare May 31, 2026 13:48
@Aanushka001

Copy link
Copy Markdown
Author

temp

@Aanushka001

Copy link
Copy Markdown
Author

Hi maintainers! 👋 I just wanted to gently follow up on this PR — it's been open for a few days now and I haven't seen any activity yet. Would love to get some feedback when anyone has a chance to look it over. Thanks!

@Carreau Carreau marked this pull request as draft June 5, 2026 09:15
@Carreau

Carreau commented Jun 5, 2026

Copy link
Copy Markdown
Member

Maintainer(s) is mostly me, your PR has a bunch of typoes and unrelated changes that would need to be undone before even starting to look at it.

Marking as draft until done.

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

2 participants