FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: fix race initializing legacy dtype casts by charris · Pull Request #28321 · numpy/numpy · GitHub

/ numpy Public

BUG: fix race initializing legacy dtype casts - #28321

Merged
charris merged 15 commits into
numpy:maintenance/2.2.xfrom
charris:backport-28290
Feb 11, 2025
Merged

charris merged 15 commits into
numpy:maintenance/2.2.xfrom
charris:backport-28290

Conversation

charris commented Feb 11, 2025

Copy link
Copy Markdown
Member

Backport of #28290.

Fixes #28048

Locks castingimpls with a critical section when the castingimpls cache is empty before writing to the dict.

Because the critical section macros have braces, I refactored PyArray_GetCastingImpl into three functions that call each other. Only the "middle" function needs the critical section, so that reduces the pain of not being able to early return in a critical section a little bit.

I also added some comments because this took me quite a while to fully understand so future readers will hopefully be less confused.

Edit: there are also some unrelated fixes for the test infrastructure to avoid CI crashes and generate better debug output from CI jobs. Happy to do those separately if anyone requests.

charris added 00 - Bug 08 - Backport Used to tag backport PRs 39 - free-threading PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703) labels Feb 11, 2025
- Checkout numpy/testing/_private/utils.py
- Checkout numpy/_core/tests/test_multithreading.py
- Checkout conftest.py
- Update test_requirements.txt
charris merged commit 56f8d5b into numpy:maintenance/2.2.x Feb 11, 2025
charris deleted the backport-28290 branch February 11, 2025 22:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 08 - Backport Used to tag backport PRs 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.

2 participants


Back | FazBrowse Home | New Git URL