Changes between Version 7 and Version 13 of Ticket #1555


Ignore:
Timestamp:
2011-10-20T18:01:25Z (12 years ago)
Author:
davidsarah
Comment:

The current version also detects captures of variables declared or modified in list comprehensions and while loops.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1555

    • Property Summary changed from add check-miscaptures.py script to check for incorrect variable captures in for loops to add check-miscaptures.py script to check for incorrect variable captures in loops
  • Ticket #1555 – Description

    v7 v13  
    1 The attached script checks for errors in which a variable declared in a {{{for}}} loop is captured by a lambda or function definition. If the lambda/function is executed after the loop iteration in which it was created, it will refer to some later value of the variable, which is usually not what was intended.
     1The attached script checks for errors in which a variable ~~declared~~modified in a ~~{{{for}}}~~ loop is captured by a lambda or function definition. If the lambda/function is executed after the loop iteration in which it was created, it will refer to some later value of the variable, which is usually not what was intended.
    22
    33~~The script currently produces false positives if a variable is declared and used in the same lambda/function within a for loop (i.e. it is not captured). I don't intend to fix that until after the Tahoe summit in November, probably.~~ However, it produces relatively few false positives already, and found some genuine bugs (see #1556).