Skip to content

BUG: call PyType_Ready in f2py to avoid data races #28133

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

ngoldbaum
Copy link
Member

@ngoldbaum ngoldbaum commented Jan 9, 2025

Fixes #28122

Chesterton's fence: I have no idea if the lack of a PyType_Ready call was intentional.

That said, it seems to be missing all the way back in 2005 so it may be that f2py has always been implicitly relying on Python finalizing the type and that's been fine until now.

@ngoldbaum ngoldbaum added the 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703) label Jan 9, 2025
@ngoldbaum ngoldbaum added the 09 - Backport-Candidate PRs tagged should be backported label Jan 9, 2025
@charris charris merged commit 709e40e into numpy:main Jan 10, 2025
68 checks passed
@charris
Copy link
Member

charris commented Jan 10, 2025

Thanks Nathan.

PyType_Ready was new in Python 2.2 (2001) when new style classes were introduced. There used to be two class hierarchies, and I suspect f2py just missed the change.

@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jan 10, 2025
@ngoldbaum
Copy link
Member Author

Thanks for that context!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: data race in f2py callback tests on free-threaded build
2 participants