cpython icon indicating copy to clipboard operation
cpython copied to clipboard

bpo-43950: implement on-the-fly source tracking for interactive mode

Open isidentical opened this issue 4 years ago • 3 comments

Purely for design purposes, do not review/merge.

https://bugs.python.org/issue43950

isidentical avatar Jul 13 '21 16:07 isidentical

One problem with this patch is that, we need to limit fetching from __source__ only for the main frame, otherwise if the offsets match out it will show something like this;

 $ ./python
Python 3.11.0a0 (heads/[bpo-43950](https://bugs.python.org/issue43950)-source-tracking-dirty:1173c11e09, Jul 17 2021, 14:52:40) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def frame_3():
...     return 1/0
... 
>>> def frame_2():
...     return frame_3()
... 
>>> def frame_1():
...     return frame_2()
... 
>>> if True:
...     1+     frame_1()
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
    1+     frame_1()
           ^^^^^^^^^
  File "<stdin>", line 2, in frame_1
    1+     frame_1()
           ^^^^^^^^^
  File "<stdin>", line 2, in frame_2
    1+     frame_1()
           ^^^^^^^^^
  File "<stdin>", line 2, in frame_3
    1+     frame_1()
           ^^^
ZeroDivisionError: division by zero

isidentical avatar Jul 17 '21 11:07 isidentical

This PR is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 17 '21 00:08 github-actions[bot]

Hey @isidentical , can this be closed now?

CAM-Gerlach avatar Oct 16 '22 02:10 CAM-Gerlach

Thanks for the reminder @CAM-Gerlach, this was mainly an experiment before it ever got to be a real PR so yep we can close it.

isidentical avatar Oct 17 '22 20:10 isidentical