-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
589b945
commit d469147
Showing
1 changed file
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ Author: Pablo Galindo <[email protected]>, | |
Batuhan Taskaya <[email protected]>, | ||
Ammar Askar <[email protected]> | ||
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 | ||
|
@@ -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``. | ||
|
@@ -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. | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
@@ -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: | ||
|
@@ -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 | ||
|