[New-bugs-announce] [issue29942] Stack overflow in itertools.chain.from_iterable.

Thomas Wouters report at bugs.python.org
Wed Mar 29 13:09:09 EDT 2017


New submission from Thomas Wouters:

itertools.chain.from_iterable (somewhat ironically) uses recursion to resolve the next iterator, which means it can run out of the C stack when there's a long run of empty iterables. This is most obvious when building with low optimisation modes, or with Py_DEBUG enabled:

Python 3.7.0a0 (heads/master:c431854a09, Mar 29 2017, 10:03:50) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import itertools
>>> next(itertools.chain.from_iterable(() for unused in range(10000000)))
Segmentation fault (core dumped)

----------
messages: 290787
nosy: gregory.p.smith, twouters
priority: normal
pull_requests: 791
severity: normal
status: open
title: Stack overflow in itertools.chain.from_iterable.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29942>
_______________________________________


More information about the New-bugs-announce mailing list