Repository navigation
Adds missing Py_INCREF in array_boolean_subscript - #4494
Conversation
There was a problem hiding this comment.
Can omit the blank line, Py_INCREF(dtype); naturally goes with the next line of code.
The function is a bit overspaced as is ;)
There was a problem hiding this comment.
Yes, probably best to group them together.
|
LGTM. Could you squash the two commits into one and rewrite the commit message. Something like |
|
thanks for debugging that for us :) |
|
@juliantaylor I thought of doing that, but given that the failure result is unpredictable and possibly a segfault was troubling. Should I just go with it anyways? |
|
yes, a test that finds an issue sometimes is better than none, that its segfaulting is no problem |
|
@embray Could you finish this up? I would like to backport it for the 1.8.1 release. |
|
this doesn't affect 1.8.x, it got introduced in the indexing rewrite |
BUG: Adds missing Py_INCREF in array_boolean_subscript
test for numpygh-4494 test median returns array scalars and works with object arrays
|
Sorry I didn't get a chance to finish this up--got sidetracked by other tasks for the last few days. Thanks! |
This bug was introduced, as far as I can tell, in 52b4a94. It came up in the context of astropy/astropy#1987 where we were getting semi-irregular segfaults. The problem is that after this line a new array is created with
PyArray_NewFromDescrusing an existing dtype object, but it does not incref that dtype object.A reliable way that I found to demonstrate this bug was something like:
at this point various different things could happen, but most often it just results in a segfault.