pythontutor-dev / pythontutor

10 stars 4 forks source link

wrong parent frame tracking in python tutor [user bug report] #108

Open pgbovine opened 4 years ago

pgbovine commented 4 years ago

From a user bug report:

def makeadder(n):
    print(n)
    def adder(k):
        print(n, k)
        return n + k
    return adder

a = makeadder(2.0)(6)
b = makeadder(2)
c = b(6)

I put the above code into python tutor, and on step 19/22, there appears a mistake. The following line showed up:

adder [parent = f1]

while this should've appeared:

adder [parent = f3]

It took me quite a while to figure out this might be a bug.

Please take a look. Thanks a lot!