[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

Serhiy Storchaka report at bugs.python.org
Thu Aug 29 04:11:26 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

The documentation changes should be backported.

And I think we need a change like PR 9254, but with raising a RuntimeError instead of adding the value to the queue, to be applied in older versions.

It may be better to apply it even to the developed version. There is nothing wrong with creating the tee iterator in one thread and using it the other thread. Or using the tee iterators with external locking. I afraid that PR 15567 can break a legitimate code.

----------
stage: resolved -> needs patch
status: closed -> open
versions: +Python 2.7, Python 3.7, Python 3.8

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


More information about the Python-bugs-list mailing list