daviis / PyDucker

A static ducking tool for python 3 source code
2 stars 2 forks source link

Del not working when subscripting into a var #77

Closed daviis closed 9 years ago

daviis commented 9 years ago

In test case Test/Correct/Ops.py line 36 visit_Delete fails.

y = [1,2,3]
del(y[0])

There will also be something from visit_Subscript going on as part of the problem.

JakeAlbee commented 9 years ago

Hmm, looking at this I see where the issue arises.

So visitSubscript looks at what is being sub scripted so when it is looking at a list it returns the item that is being looked at, in this case deleted. The elements in a list don't have a name so del(y[0]) is attempting to delete the name "" from the scope.

I'm not entirely sure how to handle this yet, I'll see what options there are. It may have to be a special case where it doesn't do anything or it may have to be a case where it modifies the list in the scope to delete the variable, which I'm not sure how will work quite yet.

JakeAlbee commented 9 years ago

Changed it to won't fix, I'll have it just pass if it is subscripting a delete so that the program can still run but we won't have to implement this.