Skip to content

ENH: chain additional exception on ufunc method lookup error - #12700

Merged
eric-wieser merged 1 commit into
numpy:masterfrom
mattip:gh-7961
Jan 13, 2019
Merged

eric-wieser merged 1 commit into
numpy:masterfrom
mattip:gh-7961

Conversation

@mattip

@mattip mattip commented Jan 9, 2019

Copy link
Copy Markdown
Member

Fixes #7961. Adds an additional exception to the exception chain when calling the object method fails (only for object inner loops).

Comment thread numpy/core/src/umath/loops.c.src Resolved
Comment thread numpy/core/src/umath/loops.c.src Resolved
@mattip

mattip commented Jan 10, 2019

Copy link
Copy Markdown
Member Author

@eric-wieser's suggestion to split the lookup and call may slightly speed up the call, since it skips some CPython code connected with arg parsing for the function, which in our case is unecessary.

@seberg seberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I think NoneType instead of None is slightly more correct, but doesn't really matter. Maybe the comment could be /* although undocumented, accept NULL for Py_None */?
I saw pytest.raises accepts a message=regular_expression, but just a note for the future.

Planning to merge (maybe with those comment/doc changes) in a while.

Comment thread numpy/core/src/umath/loops.c.src Resolved
Comment thread numpy/core/src/umath/loops.c.src Resolved
@eric-wieser
eric-wieser merged commit 4a16f56 into numpy:master Jan 13, 2019
@eric-wieser

eric-wieser commented Jan 13, 2019 •

Copy link
Copy Markdown
Member

Thanks @mattip for addressing this so quickly. I imagine if we look a little further we can close a few more issues with this. Searching for AttributeError finds a reasonable set of candidates.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants