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

BUG: fix stringdtype singleton thread safety#28862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
seberg merged 2 commits intonumpy:mainfromngoldbaum:stringdtype-singleton-fixes
Apr 29, 2025

Conversation

ngoldbaum
Copy link
Member

Fixes#28813.

Two orthogonal but related fixes.

First, to guard against newly created StringDType instances being shared between threads, we acquire the allocator lock before reading and possibly setting thearray_owned flag on a descriptor passed to the descriptor finalization function.

Second, I completely removed thesingleton forStringDType. SinceStringDType uses per-array descriptors, we're always going to need to create a new descriptor for each array anyway. We probably don't want an array to use a globally shared instance either. The tests pass with no other changes to the codebase besides deleting the code that creates the singleton, so I think it's not needed for anything either.

Not sure if we're going to do another 2.2.x, but I think this is also safe to backport.

@ngoldbaumngoldbaum added 09 - Backport-CandidatePRs tagged should be backported component: numpy.stringsString dtypes and functions 39 - free-threadingPRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703) labelsApr 29, 2025
@ngoldbaumngoldbaum added this to the2.2.6 release milestoneApr 29, 2025
Copy link
Member

@sebergseberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks, LGTM, and I think changing the singleton toarray_owned should be safe to backport.

@sebergseberg merged commit1672b69 intonumpy:mainApr 29, 2025
74 checks passed
@charrischarris added 09 - Backport-CandidatePRs tagged should be backported and removed 09 - Backport-CandidatePRs tagged should be backported labelsApr 29, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sebergsebergseberg approved these changes

Assignees
No one assigned
Labels
00 - Bug39 - free-threadingPRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)component: numpy.stringsString dtypes and functions
Projects
None yet
Milestone
2.2.6 release
Development

Successfully merging this pull request may close these issues.

BUG: Data race in stringdtype_finalize_descr under free-threading
3 participants
@ngoldbaum@seberg@charris

[8]ページ先頭

©2009-2025 Movatter.jp