Skip to content

Commit

Permalink
PEP-657: Mark PEP657 as final (GH-2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
ammaraskar authored Jul 17, 2021
1 parent 589b945 commit d469147
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit d469147

Please sign in to comment.