Skip to content

Commit 5f685ed

Browse files
[3.12] GH-109190: Copyedit 3.12 What's New: Improved Error Messages (GH-109654) (#109687)
(cherry picked from commit 16c2402) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
1 parent 92f2e33 commit 5f685ed

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Doc/whatsnew/3.12.rst

+5-6
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Improved Error Messages
9999

100100
* Modules from the standard library are now potentially suggested as part of
101101
the error messages displayed by the interpreter when a :exc:`NameError` is
102-
raised to the top level. Contributed by Pablo Galindo in :gh:`98254`.
102+
raised to the top level. (Contributed by Pablo Galindo in :gh:`98254`.)
103103

104104
>>> sys.version_info
105105
Traceback (most recent call last):
@@ -110,25 +110,24 @@ Improved Error Messages
110110
Now if a :exc:`NameError` is raised in a method and the instance has an
111111
attribute that's exactly equal to the name in the exception, the suggestion
112112
will include ``self.<NAME>`` instead of the closest match in the method
113-
scope. Contributed by Pablo Galindo in :gh:`99139`.
113+
scope. (Contributed by Pablo Galindo in :gh:`99139`.)
114114

115115
>>> class A:
116116
... def __init__(self):
117117
... self.blech = 1
118118
...
119119
... def foo(self):
120120
... somethin = blech
121-
121+
...
122122
>>> A().foo()
123123
Traceback (most recent call last):
124124
File "<stdin>", line 1
125125
somethin = blech
126126
^^^^^
127127
NameError: name 'blech' is not defined. Did you mean: 'self.blech'?
128128

129-
130129
* Improve the :exc:`SyntaxError` error message when the user types ``import x
131-
from y`` instead of ``from y import x``. Contributed by Pablo Galindo in :gh:`98931`.
130+
from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :gh:`98931`.)
132131

133132
>>> import a.y.z from b.y.z
134133
Traceback (most recent call last):
@@ -139,7 +138,7 @@ Improved Error Messages
139138

140139
* :exc:`ImportError` exceptions raised from failed ``from <module> import
141140
<name>`` statements now include suggestions for the value of ``<name>`` based on the
142-
available names in ``<module>``. Contributed by Pablo Galindo in :gh:`91058`.
141+
available names in ``<module>``. (Contributed by Pablo Galindo in :gh:`91058`.)
143142

144143
>>> from collections import chainmap
145144
Traceback (most recent call last):

0 commit comments

Comments
 (0)