Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-145202: Fix segfault in unicodedata.iter_graphemes when cleared by GC#145203

Closed
gourijain029-del wants to merge 1 commit intopython:mainfrom
gourijain029-del:fix-unicodedata-iter-graphemes-segfault
Closed

gh-145202: Fix segfault in unicodedata.iter_graphemes when cleared by GC#145203
gourijain029-del wants to merge 1 commit intopython:mainfrom
gourijain029-del:fix-unicodedata-iter-graphemes-segfault

Conversation

@gourijain029-del
Copy link

This PR fixes a segmentation fault inunicodedata.iter_graphemes and its segment objects, which occurred when the objects were cleared by the garbage collector before being deallocated.

In Modules/unicodedata.c, bothGraphemeBreakIterator andSegmentObject havetp_clear implementations that set their string references to NULL. However, their deallocators were usingPy_DECREF instead ofPy_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 usePy_XDECREF to safely handle these NULL references.

Fixesgh-145202.

@serhiy-storchaka
Copy link
Member

#145216 is an alternative solution. I do not think we needtp_clear here at first place.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@serhiy-storchakaserhiy-storchakaAwaiting requested review from serhiy-storchaka

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Segfault fromunicodedata.iter_graphemes on a free threaded build

2 participants

@gourijain029-del@serhiy-storchaka

[8]ページ先頭

©2009-2026 Movatter.jp