Ticket #132 (closed defect: fixed)

Opened 5 years ago

Last modified 5 months ago

Deletion of local variables in functions is not supported

Reported by: scoder Owned by: vitja
Priority: major Milestone: 0.15
Component: Pure Python Mode Keywords:
Cc:

Description

def test():
    i = 1
    del i

raises a compiler error. Supporting this might depend on better flow analysis.

A half-way-there implementation for local Python variables can be DECREF-ing them and setting them to NULL on "del", so that you'd get a compile time crash if you use them later on. This expects that users who use "del" know what they are doing.

Change History

Changed 5 years ago by dagss

As long as the objective here is only full Python compatability, I think it should be OK to have "del" trigger checking for NULL on all access to the variable within the function. Horrible for speed but if you want speed, just set the objects to None instead. I think this is more reasonable than expecting the users of del to be experts.

Changed 5 months ago by scoder

  • owner changed from somebody to vitja
  • milestone changed from 1.0 to 0.15

Changed 5 months ago by scoder

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.