Skip to content

Commit 03328a3

Browse files
AA-Turnercsm10495
authored andcommitted
pythonGH-109190: Copyedit 3.12 What's New: Improved Error Messages (python#109654)
1 parent 08cdf0e commit 03328a3

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
@@ -98,7 +98,7 @@ Improved Error Messages
9898

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)