-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed as duplicate of#58218
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Crash report
When the following code is ran, It causes a Segmentation Fault:
a = []
for x in range(100_000):
a = map(int, a)
list(a)
Now the list
call calls Python/bltinmodule.c:map_next
.
If we run the code with gdb, we get the following:
Program received signal SIGSEGV, Segmentation fault.
But we also get:
0x00005555557bbd6e in map_next (lz=0x7ffff7099ba0) at Python/bltinmodule.c:1342
To inspect the call stack, we can type where
into gdb and we get loads of function calls, all seeming to be coming from line 1363, which is:
PyObject *val = Py_TYPE(it)->tp_iternext(it);
And the value of Py_TYPE(it)
is a map
and it calls map_next
which causes the recursion
Error message
Segmentation Fault
Core file
Core file: Google Drive Link
Possible fix
We could add a recursion limit like we have with regular python functions.
Your environment
- CPython versions tested on: 3.9, 3.10, 3.12.0a5+
- Operating system and architecture: Windows & Linux, x86-64
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump