-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore lineno's for Input mapped files (#13560)
* Implement lineno's for Input mapped files * Adopt In [123], line 123 format * Revert "Set co_name for cells run line by line. Fixes ipython/ipykernel#841" (This reverts commit d11e987.) * Omit mention of ", in <module>" for input tracebacks * Input cell -> Cell * Remove <module> from traceback doctests * Use f-string for `in ...' format * Simplify _format_list logic, converting to f-strings
- Loading branch information
Showing
4 changed files
with
78 additions
and
59 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
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
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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Restore line numbers for Input | ||
================================== | ||
|
||
Line number information in tracebacks from input are restored. | ||
Line numbers from input were removed during the transition to v8 enhanced traceback reporting. | ||
|
||
So, instead of:: | ||
|
||
--------------------------------------------------------------------------- | ||
ZeroDivisionError Traceback (most recent call last) | ||
Input In [3], in <cell line: 1>() | ||
----> 1 myfunc(2) | ||
|
||
Input In [2], in myfunc(z) | ||
1 def myfunc(z): | ||
----> 2 foo.boo(z-1) | ||
|
||
File ~/code/python/ipython/foo.py:3, in boo(x) | ||
2 def boo(x): | ||
----> 3 return 1/(1-x) | ||
|
||
ZeroDivisionError: division by zero | ||
|
||
The error traceback now looks like:: | ||
|
||
--------------------------------------------------------------------------- | ||
ZeroDivisionError Traceback (most recent call last) | ||
Cell In [3], line 1 | ||
----> 1 myfunc(2) | ||
|
||
Cell In [2], line 2, in myfunc(z) | ||
1 def myfunc(z): | ||
----> 2 foo.boo(z-1) | ||
|
||
File ~/code/python/ipython/foo.py:3, in boo(x) | ||
2 def boo(x): | ||
----> 3 return 1/(1-x) | ||
|
||
ZeroDivisionError: division by zero | ||
|
||
or, with xmode=Plain:: | ||
|
||
Traceback (most recent call last): | ||
Cell In [12], line 1 | ||
myfunc(2) | ||
Cell In [6], line 2 in myfunc | ||
foo.boo(z-1) | ||
File ~/code/python/ipython/foo.py:3 in boo | ||
return 1/(1-x) | ||
ZeroDivisionError: division by zero |