PySnooper icon indicating copy to clipboard operation
PySnooper copied to clipboard

Minor bug in nesting

Open iory opened this issue 5 years ago • 0 comments

There is a minor bug at the nesting case. Following is the example.

import time
import pysnooper

snoop = pysnooper.snoop()

def test():
    with snoop:
        a = 10
        with snoop:
            time.sleep(1.0)
        a = 20
        time.sleep(1.0)


test()

The output is the following.

Source path:... <ipython-input-2-9ee7fdb55b80>
22:57:41.232785 line        11         a = 10
New var:....... a = 10
22:57:41.232850 line        12         with snoop:
22:57:41.232936 line        13             time.sleep(1.0)

The debug outputs of the a = 20 and time.sleep(1.0) are vanished. I don't think we'll use it like this, but I'll report it.

iory avatar Apr 18 '20 14:04 iory