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 <rep...@bugs.python.org>
<http://bugs.python.org/issue29942>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to