Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
3.11 Whatsnew: Revise desc of enhanced error locations feature
  • Loading branch information
CAM-Gerlach committed Aug 14, 2022
commit d0e8c28ea824d35c216d01ef4d01f7692da64bd2
26 changes: 14 additions & 12 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ New Features

.. _whatsnew311-pep657:

Enhanced error locations in tracebacks
--------------------------------------
PEP 657: Enhanced error locations in tracebacks
-----------------------------------------------

When printing tracebacks, the interpreter will now point to the exact expression
that caused the error instead of just the line. For example:
that caused the error, instead of just the line. For example:

.. code-block:: python

Expand All @@ -119,9 +119,9 @@ that caused the error instead of just the line. For example:
^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'x'

Previous versions of the interpreter would point to just the line making it
Previous versions of the interpreter would point to just the line, making it
ambiguous which object was ``None``. These enhanced errors can also be helpful
when dealing with deeply nested dictionary objects and multiple function calls,
when dealing with deeply nested :class:`dict` objects and multiple function calls:

.. code-block:: python
Comment on lines +128 to 130
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use this here?

Suggested change
when dealing with deeply nested :class:`dict` objects and multiple function calls:
.. code-block:: python
when dealing with deeply nested :class:`dict` objects and multiple function calls::

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see a strong reason to change this from the original source, since it renders equivalently, is a little more explicit and (IIRC) warns if the syntax used doesn't actually lex according to the declared lexer (vs. :: fails silently). But I can if you think its important


Expand All @@ -139,7 +139,7 @@ when dealing with deeply nested dictionary objects and multiple function calls,
~~~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

as well as complex arithmetic expressions:
As well as complex arithmetic expressions:

.. code-block:: python
Comment on lines +146 to 148
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As well as complex arithmetic expressions:
.. code-block:: python
As well as complex arithmetic expressions::

Same here, and possibly elsewhere.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above—I can do this if you really think its necessary, but I'm not sure it is.


Expand All @@ -153,12 +153,14 @@ See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan Taskaya
and Ammar Askar in :issue:`43950`.)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and Ammar Askar in :issue:`43950`.)
and Ammar Askar in :gh:`88116`.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above


.. note::
This feature requires storing column positions in code objects which may
result in a small increase of disk usage of compiled Python files or
interpreter memory usage. To avoid storing the extra information and/or
deactivate printing the extra traceback information, the
:option:`-X` ``no_debug_ranges`` command line flag or the :envvar:`PYTHONNODEBUGRANGES`
environment variable can be used.
This feature requires storing column positions in :ref:`codeobjects`,
which may result in a small increase in interpreter memory usage
and disk usage for compiled Python files.
To avoid storing the extra information
and deactivate printing the extra traceback information,
use the :option:`-X no_debug_ranges <-X>` command line option
Comment thread
ezio-melotti marked this conversation as resolved.
or the :envvar:`PYTHONNODEBUGRANGES` environment variable.


Column information for code objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down