Title: Segmentation fault in Python 3.13 when chaining deep filter() iterators · Issue #137894 · python/cpython · GitHub
Open Graph Title: Segmentation fault in Python 3.13 when chaining deep filter() iterators · Issue #137894 · python/cpython
X Title: Segmentation fault in Python 3.13 when chaining deep filter() iterators · Issue #137894 · python/cpython
Description: Crash report What happened? 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 ...
Open Graph Description: Crash report What happened? 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 rai...
X Description: Crash report What happened? 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 rai...
Opengraph URL: https://github.com/python/cpython/issues/137894
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Segmentation fault in Python 3.13 when chaining deep filter() iterators","articleBody":"# Crash report\n\n### What happened?\n\nWhen 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.\n\nThis 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.\n\n\n```python\nif __name__ == '__main__':\n import sys\n import gc\n \n def main():\n i = filter(bool, range(1000000))\n for _ in range(100000):\n i = filter(bool, i)\n print(list(i))\n\n #sys.setrecursionlimit(1000000)\n main()\n```\n\n\n\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.13.2 crashes with:Segmentation fault (core dumped) Python 3.12.9 executes successfully (though very slow).\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-137895\n* gh-137896\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/hutuhutong","@type":"Person","name":"hutuhutong"},"datePublished":"2025-08-18T05:52:57Z","url":"https://github.com/python/cpython/issues/137894"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c44b01da-4a13-6fd0-ffc8-c0bd8f885a5f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 92AC:4E2F:254A7:2FA52:6B0222E9 |
| html-safe-nonce | acc6e34f58bae2e5a991e6588da0b4da47031be1d6f75b13aef5635c15d780de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MkFDOjRFMkY6MjU0QTc6MkZBNTI6NkIwMjIyRTkiLCJ2aXNpdG9yX2lkIjoiNDYyMjk1NDQzMzg1OTQyOTA5NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 477c9386f89d0c2acabd8ff064c9cf1f2a459a02f60064f113fa7d836b099a4d |
| hovercard-subject-tag | issue:3329265966 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/137894/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cba02b97b5d11c6edc4e44e3bc5a0ad203c57cff258314bcc988fe45a90f2957/python/cpython/issues/137894 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cba02b97b5d11c6edc4e44e3bc5a0ad203c57cff258314bcc988fe45a90f2957/python/cpython/issues/137894 |
| og:image:alt | Crash report What happened? 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 rai... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hutuhutong |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width