Issue 25429: Can segfault Python with itertools.chain.from_iterable
Issue25429
Created on 2015-10-17 02:11 by Evan Hubinger, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg253112 - (view) | Author: Evan Hubinger (Evan Hubinger) * | Date: 2015-10-17 02:11 | |
The code import itertools it = itertools.chain.from_iterable((f() for f in [lambda: it])) list(it) definitely segfaults on Python 2.6, 2.7, 3.3, and 3.4, and probably segfaults on other versions as well. The code is clearly incorrect in that the lambda references the variable being defined, but it seems like it should raise an error instead of segfaulting. |
|||
| msg253119 - (view) | Author: Josh Rosenberg (josh.r) * ![]() |
Date: 2015-10-17 04:46 | |
Also crashes in 3.5.0 (on Windows 7, with 64 bit build). |
|||
| msg253120 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2015-10-17 05:11 | |
This is a duplicate of Issue #14010. This issue runs deep and isn't itertools specific. Running infinite chains of iterators pushes a number of CPython internals past their limits. The best solutions are hard (monitoring the C-stack or fixing every possible fault at the fracture point). The simplest solution (adding recursion count tracking to every possible iteration)is very heavy-handed and would slow-down all of Python in order to spare exotic cases that don't seem to arise in practice. |
|||
| msg253123 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2015-10-17 06:57 | |
Actually this issue an exact duplicate of issue22911 that is a duplicate of issue14010. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:22 | admin | set | github: 69615 |
| 2015-10-17 17:17:52 | zach.ware | set | stage: resolved |
| 2015-10-17 06:58:28 | serhiy.storchaka | set | superseder: deeply nested itertools objects segfault |
| 2015-10-17 06:57:29 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg253123 |
| 2015-10-17 05:11:29 | rhettinger | set | status: open -> closed resolution: duplicate messages: + msg253120 |
| 2015-10-17 04:46:43 | josh.r | set | nosy:
+ josh.r messages: + msg253119 |
| 2015-10-17 03:00:15 | zach.ware | set | assignee: rhettinger nosy:
+ rhettinger |
| 2015-10-17 02:11:53 | Evan Hubinger | create | |

