Post #1978211
2026-02-24 14:23 UTC
After 5 hours, found the problem. I have a function which creates a generator and returns a generator, like:
def f(filename):
it = g(filename)
def process_it():
for value in it:
yield value*2
return process_it()
I needed
def process_it():
try:
for value in it:
yield value*2
finally:
it.close()
I used traceback.print_stack() to help figure out if I was in a normal close() or in gc close, since it's a few levels deep.
Replies (0)
No replies.