|
msg392054 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-04-27 10:58 |
If we could include column offsets from the AST nodes for every bytecode instructions we could leverage these to offer much better tracebacks and a lot more information to debuggers and similar tools. For instance, in an expression such as:
z['aaaaaa']['bbbbbb']['cccccc']['dddddd].sddfsdf.sdfsdf
where one of these elements is None, we could tell exactly what of these pieces is the actual None and we could do some cool highlighting on tracebacks.
Similarly, coverage tools and debuggers could also make this distinction and therefore could offer reports with more granularity.
The cost is not 0: it would be two integers per bytecode instruction, but I think it may be worth the effort.
|
|
msg392062 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-04-27 12:33 |
I'm going to prepare a PEP since the discussion regarding if the two integers per bytecode are worth enough is going to be eternal.
|
|
msg392081 - (view) |
Author: Mark Shannon (Mark.Shannon) *  |
Date: 2021-04-27 14:40 |
The additional cost will not only be the line number table, but we need to store the line for exceptions that are reraised after cleanup.
Adding a column will mean more stack consumption.
|
|
msg392082 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-04-27 14:44 |
Yup, but I still think is worth the cost, giving that debugging improvements are usually extremely popular among users.
|
|
msg392520 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2021-04-30 22:28 |
Specific examples of current messages and proposed improvements would help focus discussion.
If you are willing to only handle code lines up to 256 chars, only 2 bytes should be needed. (0,0) or (255,255) could mean 'somewhere beyond the 256th char'.
|
|
msg392540 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-04-30 23:25 |
> Specific examples of current messages and proposed improvements would help focus discussion.
Yeah, I am proposing going from:
>>> x['aaaaaa']['bbbbbb']['cccccc']['dddddd'].sddfsdf.sdfsdf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not subscriptable
to
>>> x['aaaaaa']['bbbbbb']['cccccc']['dddddd'].sddfsdf.sdfsdf
^^^^^^^^^^
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not subscriptable
|
|
msg392541 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-04-30 23:26 |
Basically, to highlight in all exceptions the range in the displayed line where the error ocurred. For instance:
>>> foo(a, b/z+2, c, 132432 /x, d /y)
^^^^^^^^^
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero
|
|
msg392555 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2021-05-01 00:51 |
Marking what expression evaluated to None would be extremely helpful. So would marking the 0 denominator when there is more than one candidate: "e = a/b + c/d". It should be easy to revise IDLE Shell's print_exception to tag the span. In some cases, the code that goes from a traceback line to a line in a file and marks it could do the same.
What would you do when the expression is not the last line?
try:
x/y
...
except Exception as e:
...
raise e
The except and raise might even be in a separate module.
I look forward to the PEP and discussion.
|
|
msg392557 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-05-01 00:59 |
> So would marking the 0 denominator when there is more than one candidate: "e = a/b + c/d".
No, it will mark the offset of the bytecode that was getting executed when the exception was raised. Is just a way to mark what is raising the particular exception
> What would you do when the expression is not the last line?
There is some logic needed to re-raise exceptions. But basically it boils down to comparate the line numbers to decide if you want to propagate or not the offsets.
|
|
msg396866 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-07-02 14:10 |
New changeset 98eee94421dcb42c15f2d7fc4cd21357722fbe2a by Pablo Galindo in branch 'main':
bpo-43950: Add code.co_positions (PEP 657) (GH-26955)
https://github.com/python/cpython/commit/98eee94421dcb42c15f2d7fc4cd21357722fbe2a
|
|
msg396874 - (view) |
Author: miss-islington (miss-islington) |
Date: 2021-07-02 19:04 |
New changeset ec8759b060eff83ff466f42c5a96d83a685016ce by Batuhan Taskaya in branch 'main':
bpo-43950: optimize column table assembling with pre-sizing object (GH-26997)
https://github.com/python/cpython/commit/ec8759b060eff83ff466f42c5a96d83a685016ce
|
|
msg396950 - (view) |
Author: miss-islington (miss-islington) |
Date: 2021-07-04 18:02 |
New changeset 44f91fc802a2b71312e9abd9e8e9dcbf02e8216d by Batuhan Taskaya in branch 'main':
bpo-43950: use 0-indexed column offsets for bytecode positions (GH-27011)
https://github.com/python/cpython/commit/44f91fc802a2b71312e9abd9e8e9dcbf02e8216d
|
|
msg396957 - (view) |
Author: miss-islington (miss-islington) |
Date: 2021-07-04 19:05 |
New changeset 693cec0e2dcafa393ed5cdaa606f8dc8e3876adf by Batuhan Taskaya in branch 'main':
bpo-43950: include position in dis.Instruction (GH-27015)
https://github.com/python/cpython/commit/693cec0e2dcafa393ed5cdaa606f8dc8e3876adf
|
|
msg396962 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-07-04 23:14 |
New changeset 5644c7b3ffd49bed58dc095be6e6148e0bb4431e by Ammar Askar in branch 'main':
bpo-43950: Print columns in tracebacks (PEP 657) (GH-26958)
https://github.com/python/cpython/commit/5644c7b3ffd49bed58dc095be6e6148e0bb4431e
|
|
msg397109 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-07-07 19:07 |
New changeset 4823d9a51281ebbc8e8d82a0dd3edc7d13ea8ac7 by Ammar Askar in branch 'main':
bpo-43950: Add option to opt-out of PEP-657 (GH-27023)
https://github.com/python/cpython/commit/4823d9a51281ebbc8e8d82a0dd3edc7d13ea8ac7
|
|
msg397352 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-07-12 19:32 |
New changeset 1890dd235f618d60c938f6904d2e1a8a56f99c1c by Batuhan Taskaya in branch 'main':
bpo-43950: Specialize tracebacks for subscripts/binary ops (GH-27037)
https://github.com/python/cpython/commit/1890dd235f618d60c938f6904d2e1a8a56f99c1c
|
|
msg397368 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-07-13 00:29 |
New changeset 9c3eaf88dc5d5bed80cc45936de06b7b3162bc6d by Ammar Askar in branch 'main':
bpo-43950: Add documentation for PEP-657 (GH-27047)
https://github.com/python/cpython/commit/9c3eaf88dc5d5bed80cc45936de06b7b3162bc6d
|
|
msg397589 - (view) |
Author: Pablo Galindo Salgado (pablogsal) *  |
Date: 2021-07-15 23:38 |
New changeset 919ad537510fdc2c750109e0bc4eceea234324b2 by Batuhan Taskaya in branch 'main':
bpo-43950: make BinOp specializations more reliable (GH-27126)
https://github.com/python/cpython/commit/919ad537510fdc2c750109e0bc4eceea234324b2
|
|
msg397666 - (view) |
Author: Ammar Askar (ammar2) *  |
Date: 2021-07-16 20:51 |
As reported by Will McGugan on twitter:
Printing may be wrong for some unicode characters like:
Traceback (most recent call last):
File "test.py", line 1, in <module>
x = ("该" / 0) + (1 / 2)
~~~~~~^
TypeError: unsupported operand type(s) for /: 'str' and 'int'
and
Traceback (most recent call last):
File "test.py", line 3, in <module>
x = ("💩" / 0) + (1 / 2)
~~~~~~~
TypeError: unsupported operand type(s) for /: 'str' and 'int'
|
|
| Date |
User |
Action |
Args |
| 2021-07-16 20:51:10 | ammar2 | set | messages:
+ msg397666 |
| 2021-07-15 23:38:19 | pablogsal | set | messages:
+ msg397589 |
| 2021-07-13 20:44:35 | BTaskaya | set | pull_requests:
+ pull_request25669 |
| 2021-07-13 16:51:02 | BTaskaya | set | pull_requests:
+ pull_request25664 |
| 2021-07-13 00:29:47 | pablogsal | set | messages:
+ msg397368 |
| 2021-07-12 19:32:48 | pablogsal | set | messages:
+ msg397352 |
| 2021-07-07 19:07:20 | pablogsal | set | messages:
+ msg397109 |
| 2021-07-06 19:11:22 | ammar2 | set | pull_requests:
+ pull_request25603 |
| 2021-07-05 17:04:37 | BTaskaya | set | pull_requests:
+ pull_request25597 |
| 2021-07-04 23:14:40 | pablogsal | set | messages:
+ msg396962 |
| 2021-07-04 19:32:55 | ammar2 | set | pull_requests:
+ pull_request25584 |
| 2021-07-04 19:32:54 | ammar2 | set | pull_requests:
+ pull_request25583 |
| 2021-07-04 19:32:48 | ammar2 | set | pull_requests:
+ pull_request25582 |
| 2021-07-04 19:05:12 | miss-islington | set | messages:
+ msg396957 |
| 2021-07-04 18:02:31 | miss-islington | set | messages:
+ msg396950 |
| 2021-07-04 15:13:06 | BTaskaya | set | pull_requests:
+ pull_request25574 |
| 2021-07-04 09:00:50 | BTaskaya | set | pull_requests:
+ pull_request25571 |
| 2021-07-02 19:04:34 | miss-islington | set | nosy:
+ miss-islington messages:
+ msg396874
|
| 2021-07-02 17:34:38 | BTaskaya | set | pull_requests:
+ pull_request25557 |
| 2021-07-02 14:10:15 | pablogsal | set | messages:
+ msg396866 |
| 2021-06-29 20:11:11 | ammar2 | set | nosy:
+ ammar2 pull_requests:
+ pull_request25524
|
| 2021-06-29 16:54:53 | aroberge | set | nosy:
+ aroberge
|
| 2021-06-29 15:06:20 | pablogsal | set | keywords:
+ patch stage: patch review pull_requests:
+ pull_request25521 |
| 2021-05-05 14:13:53 | BTaskaya | set | nosy:
+ BTaskaya
|
| 2021-05-01 00:59:23 | pablogsal | set | messages:
+ msg392557 |
| 2021-05-01 00:51:48 | terry.reedy | set | messages:
+ msg392555 |
| 2021-04-30 23:51:16 | brandtbucher | set | nosy:
+ brandtbucher
|
| 2021-04-30 23:26:53 | pablogsal | set | messages:
+ msg392541 |
| 2021-04-30 23:25:22 | pablogsal | set | messages:
+ msg392540 |
| 2021-04-30 22:28:13 | terry.reedy | set | nosy:
+ terry.reedy messages:
+ msg392520
|
| 2021-04-27 14:44:12 | pablogsal | set | messages:
+ msg392082 |
| 2021-04-27 14:40:46 | Mark.Shannon | set | messages:
+ msg392081 |
| 2021-04-27 12:33:31 | pablogsal | set | messages:
+ msg392062 |
| 2021-04-27 10:58:54 | pablogsal | set | nosy:
+ nedbat, serhiy.storchaka
|
| 2021-04-27 10:58:38 | pablogsal | create | |