We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be31ecf commit 6168e71Copy full SHA for 6168e71
Doc/whatsnew/3.12.rst
@@ -75,6 +75,15 @@ Important deprecations, removals or restrictions:
75
Improved Error Messages
76
=======================
77
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
87
* Improve the error suggestion for :exc:`NameError` exceptions for instances.
88
Now if a :exc:`NameError` is raised in a method and the instance has an
89
attribute that's exactly equal to the name in the exception, the suggestion
0 commit comments