Title: initconfig.c: `SET_ITEM` macro leaks dict on expression failure · Issue #146244 · python/cpython · GitHub
Open Graph Title: initconfig.c: `SET_ITEM` macro leaks dict on expression failure · Issue #146244 · python/cpython
X Title: initconfig.c: `SET_ITEM` macro leaks dict on expression failure · Issue #146244 · python/cpython
Description: Bug report Bug description: Parent: #146102 SET_ITEM macro at line 510-521: when the expression (e.g., PyLong_FromLong) returns NULL, return NULL at line 514 leaks the dict allocated at line 505. The PyDict_SetItemString failure path cor...
Open Graph Description: Bug report Bug description: Parent: #146102 SET_ITEM macro at line 510-521: when the expression (e.g., PyLong_FromLong) returns NULL, return NULL at line 514 leaks the dict allocated at line 505. T...
X Description: Bug report Bug description: Parent: #146102 SET_ITEM macro at line 510-521: when the expression (e.g., PyLong_FromLong) returns NULL, return NULL at line 514 leaks the dict allocated at line 505. T...
Opengraph URL: https://github.com/python/cpython/issues/146244
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"initconfig.c: `SET_ITEM` macro leaks dict on expression failure","articleBody":"# Bug report\n\n### Bug description:\n\nParent: https://github.com/python/cpython/issues/146102\n\nSET_ITEM macro at line 510-521: when the expression (e.g., `PyLong_FromLong`) `returns NULL`, return NULL at line 514 leaks the `dict` allocated at line 505. The `PyDict_SetItemString` failure path correctly uses goto fail.\n\n### CPython versions tested on:\n\nCPython main branch\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-146246\n* gh-146432\n* gh-146433\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/Wulian233","@type":"Person","name":"Wulian233"},"datePublished":"2026-03-21T08:23:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/146244/cpython/issues/146244"}
| 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:6efad99d-b5a5-583f-aa87-023f1a2e3ecd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CAB0:48B83:541E507:752CF50:6A510294 |
| html-safe-nonce | ef53513b914473313ff380fb6f247756741064fd178b88f9437b214e7f13a6f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUIwOjQ4QjgzOjU0MUU1MDc6NzUyQ0Y1MDo2QTUxMDI5NCIsInZpc2l0b3JfaWQiOiI1NDE0ODQ1NDYxNzgyMjA2OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 301f9ba4cbd61aab6169d9f434e249c74d701a139c5e93b251e1e6e67060b089 |
| hovercard-subject-tag | issue:4111801892 |
| 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/146244/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2276a8825b2bc029e38fd94fdec9239d7d464fb22402afabf48a25bf6fa757c8/python/cpython/issues/146244 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2276a8825b2bc029e38fd94fdec9239d7d464fb22402afabf48a25bf6fa757c8/python/cpython/issues/146244 |
| og:image:alt | Bug report Bug description: Parent: #146102 SET_ITEM macro at line 510-521: when the expression (e.g., PyLong_FromLong) returns NULL, return NULL at line 514 leaks the dict allocated at line 505. T... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Wulian233 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 38906a4da4e3e9fd88dfeacee232f5932c0c5f7495de3b4efc53ddfac7173d12 |
| 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 | 90441ea9b98e7491aa6ebcd135fccce4e2396f48 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width