Title: Segfault with lambda nested in comprehension · Issue #104377 · python/cpython · GitHub
Open Graph Title: Segfault with lambda nested in comprehension · Issue #104377 · python/cpython
X Title: Segfault with lambda nested in comprehension · Issue #104377 · python/cpython
Description: def gen_params(): def bound(): return [lambda: T for T in (T, [1])[1]] T = ... This segfaults on current main. Stack trace: Details (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8...
Open Graph Description: def gen_params(): def bound(): return [lambda: T for T in (T, [1])[1]] T = ... This segfaults on current main. Stack trace: Details (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reas...
X Description: def gen_params(): def bound(): return [lambda: T for T in (T, [1])[1]] T = ... This segfaults on current main. Stack trace: Details (lldb) bt * thread #1, queue = 'com.apple.main-thread', s...
Opengraph URL: https://github.com/python/cpython/issues/104377
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Segfault with lambda nested in comprehension","articleBody":"```\r\ndef gen_params():\r\n def bound():\r\n return [lambda: T for T in (T, [1])[1]]\r\n T = ...\r\n```\r\n\r\nThis segfaults on current main.\r\n\r\nStack trace:\r\n\r\n\u003cdetails\u003e\r\n\r\n```\r\n(lldb) bt\r\n* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)\r\n * frame #0: 0x000000010008bcc4 python.exe`Py_TYPE(ob=0x0000000000000000) at object.h:204:16 [opt]\r\n frame #1: 0x000000010008d414 python.exe`Py_IS_TYPE(ob=\u003cunavailable\u003e, type=0x00000001004210b8) at object.h:235:12 [opt]\r\n frame #2: 0x000000010008e4c0 python.exe`_PyCode_ConstantKey(op=0x0000000000000000) at codeobject.c:2163:11 [opt]\r\n frame #3: 0x000000010008e688 python.exe`_PyCode_ConstantKey(op=0x0000000102a42620) at codeobject.c:2225:24 [opt]\r\n frame #4: 0x000000010016deec python.exe`_PyCompile_ConstCacheMergeOne(const_cache=0x000000010282d610, obj=0x000000016fdfefd8) at compile.c:6943:21 [opt]\r\n frame #5: 0x0000000100149330 python.exe`makecode(umd=0x0000000102b04820, a=0x000000016fdff050, const_cache=0x000000010282d610, constslist=0x0000000102a419a0, maxdepth=5, nlocalsplus=2, code_flags=19, filename=0x00000001028761b0) at assemble.c:568:9 [opt]\r\n frame #6: 0x000000010014905c python.exe`_PyAssemble_MakeCodeObject(umd=0x0000000102b04820, const_cache=0x000000010282d610, consts=0x0000000102a419a0, maxdepth=5, instrs=\u003cunavailable\u003e, nlocalsplus=2, code_flags=19, filename=0x00000001028761b0) at assemble.c:597:14 [opt]\r\n frame #7: 0x000000010016f1ec python.exe`optimize_and_assemble_code_unit(u=0x0000000102b04600, const_cache=0x000000010282d610, code_flags=19, filename=0x00000001028761b0) at compile.c:7219:10 [opt]\r\n frame #8: 0x000000010016f030 python.exe`optimize_and_assemble(c=0x000000010288b610, addNone=1) at compile.c:7246:12 [opt]\r\n frame #9: 0x0000000100170f84 python.exe`compiler_function(c=0x000000010288b610, s=0x0000000102063f10, is_async=0) at compile.c:2166:10 [opt]\r\n frame #10: 0x000000010016faec python.exe`compiler_visit_stmt(c=0x000000010288b610, s=0x0000000102063f10) at compile.c:3518:16 [opt]\r\n frame #11: 0x0000000100170f40 python.exe`compiler_function(c=0x000000010288b610, s=0x0000000104008530, is_async=0) at compile.c:2158:9 [opt]\r\n frame #12: 0x000000010016faec python.exe`compiler_visit_stmt(c=0x000000010288b610, s=0x0000000104008530) at compile.c:3518:16 [opt]\r\n frame #13: 0x000000010016e438 python.exe`compiler_codegen(c=0x000000010288b610, mod=0x0000000104008590) at compile.c:1684:9 [opt]\r\n frame #14: 0x000000010016dcdc python.exe`compiler_mod(c=0x000000010288b610, mod=\u003cunavailable\u003e) at compile.c:1702:9 [opt]\r\n frame #15: 0x000000010016dbf8 python.exe`_PyAST_Compile(mod=0x0000000104008590, filename=\u003cunavailable\u003e, pflags=\u003cunavailable\u003e, optimize=\u003cunavailable\u003e, arena=\u003cunavailable\u003e) at compile.c:575:24 [opt]\r\n frame #16: 0x00000001001bae6c python.exe`run_mod(mod=\u003cunavailable\u003e, filename=\u003cunavailable\u003e, globals=0x000000010282ce30, locals=0x000000010282ce30, flags=\u003cunavailable\u003e, arena=\u003cunavailable\u003e) at pythonrun.c:1707:24 [opt]\r\n frame #17: 0x00000001001b9e90 python.exe`PyRun_InteractiveOneObjectEx(fp=0x0000000209e4b848, filename=0x00000001028761b0, flags=0x000000016fdff550) at pythonrun.c:260:9 [opt]\r\n frame #18: 0x00000001001b9878 python.exe`_PyRun_InteractiveLoopObject(fp=0x0000000209e4b848, filename=0x00000001028761b0, flags=0x000000016fdff550) at pythonrun.c:137:15 [opt]\r\n frame #19: 0x00000001001b96f8 python.exe`_PyRun_AnyFileObject(fp=0x0000000209e4b848, filename=0x00000001028761b0, closeit=0, flags=0x000000016fdff550) at pythonrun.c:72:15 [opt]\r\n frame #20: 0x00000001001b9c64 python.exe`PyRun_AnyFileExFlags(fp=0x0000000209e4b848, filename=\u003cunavailable\u003e, closeit=0, flags=0x000000016fdff550) at pythonrun.c:104:15 [opt]\r\n frame #21: 0x00000001001d8d78 python.exe`pymain_run_stdin(config=0x000000010054a2c0) at main.c:520:15 [opt]\r\n frame #22: 0x00000001001d8444 python.exe`pymain_run_python(exitcode=0x000000016fdff5ec) at main.c:613:21 [opt]\r\n frame #23: 0x00000001001d82ac python.exe`Py_RunMain at main.c:689:5 [opt]\r\n frame #24: 0x00000001001d8524 python.exe`pymain_main(args=0x000000016fdff650) at main.c:719:12 [opt]\r\n frame #25: 0x00000001001d8568 python.exe`Py_BytesMain(argc=\u003cunavailable\u003e, argv=\u003cunavailable\u003e) at main.c:743:12 [opt]\r\n frame #26: 0x0000000100003e94 python.exe`main(argc=\u003cunavailable\u003e, argv=\u003cunavailable\u003e) at python.c:15:12 [opt]\r\n frame #27: 0x000000010086108c dyld`start + 520\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\nI got crashes here at some point too while working on PEP 695; I think it means there's something wrong with how the cellvars/freevars are tracked.\r\n\r\ncc @carljm.\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104394\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2023-05-11T01:27:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/104377/cpython/issues/104377"}
| 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:f50f1d42-6a9f-fde8-ef7a-780011689948 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC60:D0F38:3F0AFF:5700AA:696A02A7 |
| html-safe-nonce | bade759e1bff88e80279d748b665c3de05550640bf66d4b619af702efa983f99 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzYwOkQwRjM4OjNGMEFGRjo1NzAwQUE6Njk2QTAyQTciLCJ2aXNpdG9yX2lkIjoiNDk4NzYwNjk0NTQ5MzU0OTczNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 02aa59da33b4ec8e9f30caab9358a2722b7ae5d1f68060bbcb43eef4cc13a49c |
| hovercard-subject-tag | issue:1704852282 |
| 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/104377/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cf7d186f46437b67b6e64218915f0a79171d35a01e1266eec1793dea824ad581/python/cpython/issues/104377 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cf7d186f46437b67b6e64218915f0a79171d35a01e1266eec1793dea824ad581/python/cpython/issues/104377 |
| og:image:alt | def gen_params(): def bound(): return [lambda: T for T in (T, [1])[1]] T = ... This segfaults on current main. Stack trace: Details (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reas... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| hostname | github.com |
| expected-hostname | github.com |
| None | 578c119ff0247c8b2f2491fbf4fc0395cdf909d4df66598cebdc96ddfc4418dc |
| 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 | 671c2f67171dbced24284331f3133a613d08c366 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width