Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark PEP657 as Final #2032

Merged
merged 2 commits into from
Jul 17, 2021
Merged
Changes from all commits
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
14 changes: 7 additions & 7 deletions pep-0657.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Author: Pablo Galindo <pablogsal@python.org>,
Batuhan Taskaya <batuhan@python.org>,
Ammar Askar <ammar@ammaraskar.com>
Discussions-To: https://discuss.python.org/t/pep-657-include-fine-grained-error-locations-in-tracebacks/8629
Status: Accepted
Status: Final
Type: Standards Track
Content-Type: text/x-rst
Created: 08-May-2021
Expand Down Expand Up @@ -56,7 +56,7 @@ as line numbers, it could helpfully display::
Traceback (most recent call last):
File "test.py", line 2, in <module>
x['a']['b']['c']['d'] = 1
^^^^^^^^^^^^^^^^
~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

indicating to the user that the object ``x['a']['b']`` must have been ``None``.
Expand All @@ -76,7 +76,7 @@ display the code associated to the current instruction in every frame::
^^^^^^
File "test.py", line 6, in lel
return 1 + foo(a,b,c=x['z']['x']['y']['z']['y'], d=e)
^^^^^^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

This problem presents itself in the following situations.
Expand Down Expand Up @@ -114,7 +114,7 @@ This problem presents itself in the following situations.
Traceback (most recent call last):
File "test.py", line 1, in <module>
x = (a + b) @ (c + d)
^^^^^
~~^~~
ValueError: operands could not be broadcast together with shapes (1,2) (2,3)

Giving a much clearer and easier to debug error message.
Expand Down Expand Up @@ -240,7 +240,7 @@ available. For instance::

File "test.py", line 6, in lel
return 1 + foo(a,b,c=x['z']['x']['y']['z']['y'], d=e)
^^^^^^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

When displaying tracebacks, instruction offsets will be taken from the
Expand All @@ -267,7 +267,7 @@ The printed traceback would look like this::
^^^^^^
File "test.py", line 2, in foo
1 + 1/0 + 2
^^^
~^~
ZeroDivisionError: division by zero

The above exception was the direct cause of the following exception:
Expand Down Expand Up @@ -303,7 +303,7 @@ Will be displayed as::
^^^^^^
File "test.py", line 2, in foo
1 + 1/0 + 2
^^^
~^~
ZeroDivisionError: division by zero

Maintaining the current behavior, only a single line will be displayed
Expand Down