Title: [C API] Make _PyTuple_FromArray() function public · Issue #111489 · python/cpython · GitHub
Open Graph Title: [C API] Make _PyTuple_FromArray() function public · Issue #111489 · python/cpython
X Title: [C API] Make _PyTuple_FromArray() function public · Issue #111489 · python/cpython
Description: I dislike PyList_New() + PyList_SET_ITEM() API since the list is immediately tracked by the GC and so calling gc.get_objects() can expose an invalid list object (ex: calling repr(list) can crash). See: capi-workgroup/problems#56 #107139 ...
Open Graph Description: I dislike PyList_New() + PyList_SET_ITEM() API since the list is immediately tracked by the GC and so calling gc.get_objects() can expose an invalid list object (ex: calling repr(list) can crash). ...
X Description: I dislike PyList_New() + PyList_SET_ITEM() API since the list is immediately tracked by the GC and so calling gc.get_objects() can expose an invalid list object (ex: calling repr(list) can crash). ...
Opengraph URL: https://github.com/python/cpython/issues/111489
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[C API] Make _PyTuple_FromArray() function public","articleBody":"I dislike `PyList_New()` + `PyList_SET_ITEM()` API since the list is immediately tracked by the GC and so calling `gc.get_objects()` can expose an invalid list object (ex: calling `repr(list)` can crash). See:\n\n* https://github.com/capi-workgroup/problems/issues/56 \n* https://github.com/python/cpython/pull/107139\n* https://github.com/capi-workgroup/api-evolution/issues/36\n\nThe internal `PyObject * _PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)` function should be made public.\n\ncc @erlend-aasland\n\n**UPDATE**: I updated the issue to request promoting `_PyTuple_FromArray()` instead of `_PyList_FromArraySteal()`.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-112975\n* gh-139691\n* gh-139973\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-10-30T11:32:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/111489/cpython/issues/111489"}
| 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:9a812d4b-d4d1-85e4-d16b-4dee62f4301e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B126:9E6E4:B14AF:FCF23:696A0A7A |
| html-safe-nonce | 05d3c410364ef33222636fec980572f3596cf7e3ebced771384f40a019b88ba1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTI2OjlFNkU0OkIxNEFGOkZDRjIzOjY5NkEwQTdBIiwidmlzaXRvcl9pZCI6IjczMjI1ODI2NjYzMzY0MDYxMzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cbb753203213857cf783f2ad208fb9c6fd17724ba8edf131edb06d1363b1c9f8 |
| hovercard-subject-tag | issue:1968125886 |
| 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/111489/issue_layout |
| twitter:image | https://opengraph.githubassets.com/28ff99cda7ae9c9606b7c8d1b2e1968b93fa8442e587fcaa91aac47ff675450f/python/cpython/issues/111489 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/28ff99cda7ae9c9606b7c8d1b2e1968b93fa8442e587fcaa91aac47ff675450f/python/cpython/issues/111489 |
| og:image:alt | I dislike PyList_New() + PyList_SET_ITEM() API since the list is immediately tracked by the GC and so calling gc.get_objects() can expose an invalid list object (ex: calling repr(list) can crash). ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 699227a00bbb7fe1eec276d2ae1c3a93068bc5ba483bd9dc4b2a27a8f4f2f595 |
| 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 | 7266b2d935baa1c6474b16dd9feaa5ca30607261 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width