Title: Crash in tkinter when passing a recursive or deeply nested list to Tcl · Issue #160176 · python/cpython · GitHub
Open Graph Title: Crash in tkinter when passing a recursive or deeply nested list to Tcl · Issue #160176 · python/cpython
X Title: Crash in tkinter when passing a recursive or deeply nested list to Tcl · Issue #160176 · python/cpython
Description: Bug report Bug description: AsObj() and TupleAsObj() in Modules/_tkinter.c convert nested lists and tuples to Tcl lists by plain C recursion with no depth limit, so a recursive or very deeply nested list passed to tk.call(), setvar(), Va...
Open Graph Description: Bug report Bug description: AsObj() and TupleAsObj() in Modules/_tkinter.c convert nested lists and tuples to Tcl lists by plain C recursion with no depth limit, so a recursive or very deeply neste...
X Description: Bug report Bug description: AsObj() and TupleAsObj() in Modules/_tkinter.c convert nested lists and tuples to Tcl lists by plain C recursion with no depth limit, so a recursive or very deeply neste...
Opengraph URL: https://github.com/python/cpython/issues/160176
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash in tkinter when passing a recursive or deeply nested list to Tcl","articleBody":"# Bug report\n\n### Bug description:\n\n`AsObj()` and `TupleAsObj()` in `Modules/_tkinter.c` convert nested lists and tuples to Tcl lists by plain C recursion with no depth limit, so a recursive or very deeply nested list passed to `tk.call()`, `setvar()`, `Variable.set()` or a widget option overflows the C stack and segfaults.\n\n```python\nimport tkinter\nv = ['a']\nv.append(v)\ntkinter.Tcl().setvar('x', v) # Segmentation fault\n```\n\nThe same happens with a list nested about 50,000 levels deep (for example one returned by `json.loads()`), and in the other direction when `getvar()` reads a Tcl list nested a few hundred thousand levels deep (`FromObj()`). I'd expect an exception, as `_flatten()` in the same file already gives with `ValueError: nesting too deep in _flatten`.\n\nThe recursion is old; gh-143310 fixed a different crash in the same code and was backported.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-160177\n* gh-161071\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/gpshead","@type":"Person","name":"gpshead"},"datePublished":"2026-10-22T04:16:47Z","url":"https://github.com/python/cpython/issues/160176"}
| 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:b540863d-519f-d6f5-6daf-69384df47fc0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C25C:4D9F2:15F81EA:1D2D07D:6B020249 |
| html-safe-nonce | 27f8a84d209c917c73b6c36ff0a27ca00f547b314a7f7d07be6d783cef858cae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjVDOjREOUYyOjE1RjgxRUE6MUQyRDA3RDo2QjAyMDI0OSIsInZpc2l0b3JfaWQiOiI2MDcwMzcwNzgyMTE3MjMzMjI1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d70d5ff8868bfed45b9e0c4dfaabd7bf5830ac5221ae2743f218cdf46853dde2 |
| hovercard-subject-tag | issue:5972954544 |
| 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/160176/issue_layout |
| twitter:image | https://opengraph.githubassets.com/870f2c3e5ce00337712c50dd52b6049f0c2e0cfdfaf3d6b84023e5b12af76a7a/python/cpython/issues/160176 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/870f2c3e5ce00337712c50dd52b6049f0c2e0cfdfaf3d6b84023e5b12af76a7a/python/cpython/issues/160176 |
| og:image:alt | Bug report Bug description: AsObj() and TupleAsObj() in Modules/_tkinter.c convert nested lists and tuples to Tcl lists by plain C recursion with no depth limit, so a recursive or very deeply neste... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gpshead |
| 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