Title: gh-116946: fully implement GC protocol for `lzma` objects by picnixz · Pull Request #138288 · python/cpython · GitHub
Open Graph Title: gh-116946: fully implement GC protocol for `lzma` objects by picnixz · Pull Request #138288 · python/cpython
X Title: gh-116946: fully implement GC protocol for `lzma` objects by picnixz · Pull Request #138288 · python/cpython
Description: Outdated conversation @ZeroIntensity Using tp_alloc directly feels wrong to me even because it's about relying on implementation details that are not documented (and not explicitly recommended by our docs recommend), while using PyObject_GC_New forces me to actually memset the structure (with an additional offset!) as otherwise I need to initialize the fields manually (this is essentially to prevent a segfault when invoking the (external) LZMA interface). So I really think we should have some PyObject_GC_New-like function that zeroes the remaining fields or a just a function for zeroing the rest of a PyObject fields, that is: void _PyObject_MemSetZero(PyObject *self, size_t basicsize) { assert(self != NULL); const size_t offset = sizeof(struct { PyObject_HEAD }); assert(basicsize >= offset); memset((char *)self + offset, 0, basicsize - offset); } and that we also have a private constant indicating the size of PyObject_HEAD. WDYT? EDIT: I was looking at the 3.13 docs but the recommendations were given in the 3.14 docs, which is why I missed them. Issue: gh-116946
Open Graph Description: Outdated conversation @ZeroIntensity Using tp_alloc directly feels wrong to me even because it's about relying on implementation details that are not documented (and not explicitly recommended ...
X Description: Outdated conversation @ZeroIntensity Using tp_alloc directly feels wrong to me even because it's about relying on implementation details that are not documented (and not explicitly recommen...
Opengraph URL: https://github.com/python/cpython/pull/138288
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9b4c5a03-8fc0-e3ef-70eb-0c5f5d04f966 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D00A:9CC2A:12B6507:19F4A1B:696A90DC |
| html-safe-nonce | f67fb55f90a705685860fa8b71f258caf864d312072a679e3a723ffebe5f6ff0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDBBOjlDQzJBOjEyQjY1MDc6MTlGNEExQjo2OTZBOTBEQyIsInZpc2l0b3JfaWQiOiI4MDI4MjA4Mjg5NDE0ODExODY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8c51751cc3a4b269b276f74e93b1d83d42a67db0cbf0abcb950e3e08baeb2fc7 |
| hovercard-subject-tag | pull_request:2787598931 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/138288/files |
| twitter:image | https://avatars.githubusercontent.com/u/10796600?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/10796600?s=400&v=4 |
| og:image:alt | Outdated conversation @ZeroIntensity Using tp_alloc directly feels wrong to me even because it's about relying on implementation details that are not documented (and not explicitly recommended ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width