• Kevin Modzelewski's avatar
    Add a test for a case we put the decref too early · 6940f10b
    Kevin Modzelewski authored
    Not sure if it matters, but there are some cases that our
    refcounter will add decrefs earlier than CPython would, if it
    can prove that the variable won't end up getting used.
    
    One example is in:
    
    for i in foo():
      break
    
    The iterator object (`iter(foo())`) will not get used after the first
    call to next().  So our system will put the decref at the top of the loop.
    CPython will do the decref after the loop exits, like normal.
    6940f10b
iter_del_time.py 316 Bytes