Skip to content

Commit 6168e71

Browse files
authoredNov 7, 2022
gh-98254: Add what's new entry for the improvement in commit bb56dea (#99197)
1 parent be31ecf commit 6168e71

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎Doc/whatsnew/3.12.rst

+9
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ Important deprecations, removals or restrictions:
7575
Improved Error Messages
7676
=======================
7777

78+
* Modules from the standard library are now potentially suggested as part of
79+
the error messages displayed by the interpreter when a :exc:`NameError` is
80+
raised to the top level. Contributed by Pablo Galindo in :gh:`98254`.
81+
82+
>>> sys.version_info
83+
Traceback (most recent call last):
84+
File "<stdin>", line 1, in <module>
85+
NameError: name 'sys' is not defined. Did you forget to import 'sys'?
86+
7887
* Improve the error suggestion for :exc:`NameError` exceptions for instances.
7988
Now if a :exc:`NameError` is raised in a method and the instance has an
8089
attribute that's exactly equal to the name in the exception, the suggestion

0 commit comments

Comments
 (0)
Please sign in to comment.