Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ Important deprecations, removals or restrictions:
Improved Error Messages
=======================

* Modules from the standard library are now potentially suggested as part of
the error messages displayed by the interpreter when an :exc:`NameError` is
Comment thread
pablogsal marked this conversation as resolved.
Outdated
raised to the top level. Contrubuted by Pablo Galindo in :gh:`98254`.
Comment thread
pablogsal marked this conversation as resolved.
Outdated

>>> sys.version_info
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'sys' is not defined. Did you forget to import 'sys'?

* Improve the error suggestion for :exc:`NameError` exceptions for instances.
Now if a :exc:`NameError` is raised in a method and the instance has an
attribute that's exactly equal to the name in the exception, the suggestion
Expand Down