donkirkby / live-py-plugin

Live coding in Python with PyCharm, Emacs, Sublime Text, or even a browser
https://donkirkby.github.io/live-py-plugin
MIT License
292 stars 56 forks source link

IndexError in @traced #323

Closed donkirkby closed 2 years ago

donkirkby commented 2 years ago

What I did

Isolate the code to be traced.

from space_tracer import traced

def foo():
    for _ in range(50000):
        pass

@traced
def bar():
    print('Done.')

foo()
bar()

What happened

IndexError, when I run the script regularly, not in live coding mode or under space_tracer.

Traceback (most recent call last):
  File "/home/don/workspace/scratch/scratch2.py", line 8, in <module>
    def bar():
  File "/home/don/git/live-py-plugin/.tox/py310/lib/python3.10/site-packages/space_tracer/main.py", line 263, in traced
    if is_in_traced_module():
  File "/home/don/git/live-py-plugin/.tox/py310/lib/python3.10/site-packages/space_tracer/main.py", line 260, in is_in_traced_module
    expected_frame = call_stack[3]
IndexError: list index out of range

What I wanted to happen

Just print Done..

My environment

Describe the versions of everything you were using: