[New-bugs-announce] [issue40047] itertools.tee does not release resources during iteration?

Peter Würtz report at bugs.python.org
Mon Mar 23 10:34:33 EDT 2020


New submission from Peter Würtz <pwuertz at gmail.com>:

Itertools `tee` does not seem to de-reference yielded items, even after consumption of all items from all tee-iterators.

According to the documentation (to my understanding), there shouldn't be any extra memory requirement as long as the tee-iterators are consumed in a balanced way. I.e. after an item was pulled from all iterators there shouldn't be any residual reference to it.

This is true for the example-implementation mentioned in the documentation, but `itertools.tee` doesn't de-reference items until the tee-iterator itself is deleted:

https://pastebin.com/r3JUkH41

Is this a bug or am I missing something?

----------
components: Library (Lib)
messages: 364849
nosy: pwuertz
priority: normal
severity: normal
status: open
title: itertools.tee does not release resources during iteration?
type: resource usage
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40047>
_______________________________________


More information about the New-bugs-announce mailing list