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

BUG: core: Don't call INCREF/DECREF on descr in NpyStringAcquireAllocator. by WarrenWeckesser · Pull Request #31456 · numpy/numpy · GitHub

/ numpy Public

BUG: core: Don't call INCREF/DECREF on descr in NpyStringAcquireAllocator. - #31456

Merged
ngoldbaum merged 2 commits into
numpy:mainfrom
WarrenWeckesser:fix-gh-31415
May 18, 2026
Merged

BUG: core: Don't call INCREF/DECREF on descr in NpyStringAcquireAllocator.#31456
ngoldbaum merged 2 commits into
numpy:mainfrom
WarrenWeckesser:fix-gh-31415

Conversation

Copy link
Copy Markdown
Member

Remove incorrect calls of Py_INCREF(descr) and Py_DECREF(descr) in the RAII object NpyStringAcquireAllocator.

Closes gh-31415.

AI Disclosure

No AI tools used.

WarrenWeckesser commented May 17, 2026
edited
Loading

Copy link
Copy Markdown
Member Author

I included the crasher that @jeromekelleher provided in gh-31415 as a test. By increasing n_cols to 10, I could get the crash to occur with high probability even with the duration of the test reduced to 2 seconds. Still, I'm not sure we want to include this in the test suite.

WarrenWeckesser marked this pull request as draft May 17, 2026 18:48
WarrenWeckesser marked this pull request as ready for review May 17, 2026 18:53
charris added 00 - Bug 09 - Backport-Candidate PRs tagged should be backported labels May 17, 2026
charris added this to the 2.4.6 release milestone May 17, 2026

jeromekelleher commented May 18, 2026
edited
Loading

Copy link
Copy Markdown

Thanks for the speedy fix @WarrenWeckesser ❤️

Copy link
Copy Markdown
Member

Still, I'm not sure we want to include this in the test suite.

We may want to have a multi-threaded test, but not with explicit time.sleep(2). There must be better patterns already in the test suite already, probably @ngoldbaum can point at an example here.

seberg commented May 18, 2026

Copy link
Copy Markdown
Member

We may want to have a multi-threaded test, but not with explicit time.sleep(2). There must be better patterns

Was just confirming that it works: But we don't need any threading at all. We just need to add a parametrization for existing tests with >500 elements or so (let's do 2000 maybe).

We have debug test runs in the test-suite, and these already hit it reliably, the only problem is that the tests don't cover larger tests.
(May be nice to also add to other tests generally, e.g. unique or some ufuncs)

Copy link
Copy Markdown
Member Author

But we don't need any threading at all. We just need to add a parametrization for existing tests with >500 elements or so (let's do 2000 maybe).

Which tests are those?

seberg commented May 18, 2026
edited
Loading

Copy link
Copy Markdown
Member

The TestStringLikeCasts will do the trick (we use it for bytes casting).

EDIT: E.g. ["short", "12345678"] * 1000, works...

This case is a regression test for numpygh-31415 when run in a debug build.

Copy link
Copy Markdown
Member Author

I removed the multi-threaded test and added the test case suggested by @seberg.

Copy link
Copy Markdown
Member

Thanks Warren!

ngoldbaum merged commit b668e0a into numpy:main May 18, 2026
86 checks passed

Copy link
Copy Markdown
Member Author

@ngoldbaum, thanks for finding my mistake 😳.

Copy link
Copy Markdown
Member

No problem, I really appreciate you taking on the fix :)

charris added a commit that referenced this pull request May 18, 2026
…ator. (#31456) (#31460)

Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
charris removed the 09 - Backport-Candidate PRs tagged should be backported label May 18, 2026
WarrenWeckesser deleted the fix-gh-31415 branch May 18, 2026 21:33
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: SIGABRT / heap corruption when two threads operate on basic-slice views of a 2-D StringDType array

6 participants


Back | FazBrowse Home | New Git URL