Title: gh-145202: Fix segfault in unicodedata.iter_graphemes when cleared by GC by gourijain029-del · Pull Request #145203 · python/cpython · GitHub
Open Graph Title: gh-145202: Fix segfault in unicodedata.iter_graphemes when cleared by GC by gourijain029-del · Pull Request #145203 · python/cpython
X Title: gh-145202: Fix segfault in unicodedata.iter_graphemes when cleared by GC by gourijain029-del · Pull Request #145203 · python/cpython
Description: This PR fixes a segmentation fault in unicodedata.iter_graphemes and its segment objects, which occurred when the objects were cleared by the garbage collector before being deallocated. In Modules/unicodedata.c, both GraphemeBreakIterator and SegmentObject have tp_clear implementations that set their string references to NULL. However, their deallocators were using Py_DECREF instead of Py_XDECREF. This led to a crash if a GC cycle (or interpreter shutdown) cleared the objects before they reached the deallocation path. I've updated GBI_dealloc and Segment_dealloc to use Py_XDECREF to safely handle these NULL references. Fixes gh-145202.
Open Graph Description: This PR fixes a segmentation fault in unicodedata.iter_graphemes and its segment objects, which occurred when the objects were cleared by the garbage collector before being deallocated. In Modules/...
X Description: This PR fixes a segmentation fault in unicodedata.iter_graphemes and its segment objects, which occurred when the objects were cleared by the garbage collector before being deallocated. In Modules/...
Opengraph URL: https://github.com/python/cpython/pull/145203
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:dd4e60bb-87a7-34ff-8b2d-8a552b7c5334 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A068:9C6CC:19B8BDF:2483156:6A50CB26 |
| html-safe-nonce | cd730c4f9540e1c2388e7c312cb00e9d326f73707821410e2c373112764fa913 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDY4OjlDNkNDOjE5QjhCREY6MjQ4MzE1Njo2QTUwQ0IyNiIsInZpc2l0b3JfaWQiOiI3Nzc2MDM3NzcxNTAwNjM2OTY2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4c548ff92f687fc24ba9a5dfdd748d15ba96252241b088692c26cad04a47b4f2 |
| hovercard-subject-tag | pull_request:3324609700 |
| 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/145203/files |
| twitter:image | https://avatars.githubusercontent.com/u/235066236?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/235066236?s=400&v=4 |
| og:image:alt | This PR fixes a segmentation fault in unicodedata.iter_graphemes and its segment objects, which occurred when the objects were cleared by the garbage collector before being deallocated. In Modules/... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 08e79d53fc070870d5b168356afebb1e286a2ffe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width