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

BUG: `OBJECT_to_*` should check for errors #12062

Merged
merged 1 commit into from Oct 1, 2018

Conversation

Projects
None yet
2 participants
@ahaldane
Copy link
Member

ahaldane commented Sep 30, 2018

Fixes #11993

The problem was OBJECT_to_* did not quit on error, and the error was cleared by subsequent calls (in PyArray_IsScalar in CDOUBLE_setitem, it seems). Probably in python3.7 they must have added a call to PyErr_Clear somewhere, which exposed this bug.

@ahaldane ahaldane force-pushed the ahaldane:fix_11993 branch from 21c13d2 to 7fdba16 Sep 30, 2018

@ahaldane ahaldane changed the title BUG: OBJECT_setitem should check for errors BUG: OBJECT_to_* should check for errors Sep 30, 2018

@@ -1489,10 +1489,14 @@ OBJECT_to_@TOTYPE@(void *input, void *output, npy_intp n,

for (i = 0; i < n; i++, ip++, op += skip) {
if (*ip == NULL) {
@TOTYPE@_setitem(Py_False, op, aop);
if (@TOTYPE@_setitem(Py_False, op, aop)) {

This comment has been minimized.

@charris

charris Oct 1, 2018

Member

func(...) < 0 is the preferred idiom for these checks. I assume an error is set on failure and checked somewhere down the call chain?

@charris

This comment has been minimized.

Copy link
Member

charris commented Oct 1, 2018

LGTM apart from a stylistic nit.

@ahaldane ahaldane force-pushed the ahaldane:fix_11993 branch from 7fdba16 to dfa2a8d Oct 1, 2018

@ahaldane

This comment has been minimized.

Copy link
Member

ahaldane commented Oct 1, 2018

Fixed.

I assume an error is set on failure and checked somewhere down the call chain?

Correct, the error is set in CDOUBLE_setitem and bubbles up in this case through OBJECT_to_CDOUBLE then aligned_contig_to_contig_cast then PyArray_CastRawArrays, and then by various ways ends up at the user.

@charris charris merged commit e9488b2 into numpy:master Oct 1, 2018

7 of 9 checks passed

codecov/patch 80% of diff hit (target 85.02%)
Details
codecov/project 85.01% (-0.01%) compared to cd4fb52
Details
LGTM analysis: C/C++ No code changes detected
Details
LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: Python No alert changes
Details
Shippable Run 627 status is SUCCESS.
Details
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@charris

This comment has been minimized.

Copy link
Member

charris commented Oct 1, 2018

Thanks Allan.

@charris charris added this to the 1.15.3 release milestone Oct 2, 2018

@ocefpaf ocefpaf referenced this pull request Oct 12, 2018

Merged

updated iris recipe to v2.2 #41

4 of 4 tasks complete

@charris charris removed this from the 1.15.3 release milestone Oct 16, 2018

@charris charris changed the title BUG: OBJECT_to_* should check for errors BUG: `OBJECT_to_*` should check for errors Nov 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment