Message382451
> I added some comments in the PR regarding the possibility of forcing the tracking on the visiting function to redirect the cost to gc passes instead of when calling next()...
Yep, I agree that this approach is better.
> ...but there is another option: not untracking tuples that have refcount == 1.
I do like the idea of not having to fix this in ~10 different places, but I'm not sure this is enough. The GC visit may happen when the refcount of the result tuple is > 1, but it may drop back to 1 before __next__ called again
z = zip([42, []])
item = next(zip)
gc.collect() # Refcount of item == 2, untracked by GC.
del item # Refcount of item == 1, ready to be recycled.
next(zip) # This should be tracked, but won't be. |
|
Date |
User |
Action |
Args |
2020-12-03 20:27:56 | brandtbucher | set | recipients:
+ brandtbucher, tim.peters, rhettinger, vstinner, serhiy.storchaka, pablogsal |
2020-12-03 20:27:56 | brandtbucher | set | messageid: <1607027276.71.0.808160797489.issue42536@roundup.psfhosted.org> |
2020-12-03 20:27:56 | brandtbucher | link | issue42536 messages |
2020-12-03 20:27:56 | brandtbucher | create | |
|