bpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)

RuntimeError is now raised in this case.
This commit is contained in:
Serhiy Storchaka 2019-09-09 11:47:14 +03:00 committed by GitHub
parent 918b468b7d
commit 526a01467b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 0 deletions

View file

@ -645,6 +645,10 @@ loops that truncate the stream.
used anywhere else; otherwise, the *iterable* could get advanced without
the tee objects being informed.
``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be
raised when using simultaneously iterators returned by the same :func:`tee`
call, even if the original *iterable* is threadsafe.
This itertool may require significant auxiliary storage (depending on how
much temporary data needs to be stored). In general, if one iterator uses
most or all of the data before another iterator starts, it is faster to use