summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/exceptions.rst7
-rw-r--r--Doc/whatsnew/3.10.rst17
2 files changed, 24 insertions, 0 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index 8fdd6eb..f4f5c47 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -242,6 +242,13 @@ The following exceptions are the exceptions that are usually raised.
unqualified names. The associated value is an error message that includes the
name that could not be found.
+ The :attr:`name` attribute can be set using a keyword-only argument to the
+ constructor. When set it represent the name of the variable that was attempted
+ to be accessed.
+
+ .. versionchanged:: 3.10
+ Added the :attr:`name` attribute.
+
.. exception:: NotImplementedError
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index f149d74..69697e1 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -187,6 +187,23 @@ raised from:
(Contributed by Pablo Galindo in :issue:`38530`.)
+NameErrors
+~~~~~~~~~~
+
+When printing :exc:`NameError` raised by the interpreter, :c:func:`PyErr_Display`
+will offer suggestions of simmilar variable names in the function that the exception
+was raised from:
+
+.. code-block:: python
+
+ >>> schwarzschild_black_hole = None
+ >>> schwarschild_black_hole
+ Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole?
+
+(Contributed by Pablo Galindo in :issue:`38530`.)
+
PEP 626: Precise line numbers for debugging and other tools
-----------------------------------------------------------