When creating a deeply nested chain of filter() iterators, Python 3.12 can handle it (although very slow), but Python 3.13 results in a segmentation fault instead of raising an exception.
This appears to be a regression in Python 3.13’s iterator implementation, as user code should never cause a segfault. Ideally, this should raise a RecursionError or another Python exception, not crash the interpreter.
I'm going to close it as a duplicate as well and not planned as the original was considered not worth the fix (which I agree as it's not a straightforward one).
Activity
pythongh-137894:Fix os.makedirs to properly pass mode parameter to re…
serhiy-storchaka commented on Aug 18, 2025
See other similar issues:
serhiy-storchaka commented on Aug 18, 2025
This is an exact duplicate of
which was closed as a duplicate of #58218.
picnixz commented on Aug 18, 2025
I'm going to close it as a duplicate as well and not planned as the original was considered not worth the fix (which I agree as it's not a straightforward one).
sergey-miryanov commented on Nov 6, 2025
FTR, I have added _Py_EnterRecursiveCall to the filter_next (sergey-miryanov@d3b76ee) and have following microbenchmark's results:
Windows 11, x64, CPU 11th Gen Intel(R) Core(TM) i5-11600K @ 3.90GHz
Ubuntu 24.04, build with --lto=full, same CPU:
Based on the results on Linux, I don't think it's worth adding yet.