-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
BUG: ensure extobj and axes have their own references. #11257
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
Conversation
@@ -555,8 +555,9 @@ ufunc_get_name_cstr(PyUFuncObject *ufunc) { | |||
* Parses the positional and keyword arguments for a generic ufunc call. | |||
* | |||
* Note that if an error is returned, the caller must free the | |||
* non-zero references in out_op. This | |||
* function does not do its own clean-up. | |||
* non-zero references in out_op. This function does not do its own clean-up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to change it so it does this too, but I suppose there's no need for that to be part of this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I thought about that too, and am happy to do a follow-up PR for that; there is no reason not to clean up.
@@ -36,6 +36,10 @@ def test_sig_dtype(self): | |||
assert_raises(RuntimeError, np.add, 1, 2, signature='ii->i', | |||
dtype=int) | |||
|
|||
def test_extobj_refcount(self): | |||
# Should not segfault with USE_DEBUG. | |||
assert_raises(TypeError, np.add, 1, 2, extobj=[4096], parrot=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid_keyword_arg
would be a little clearer than parrot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I finally got a Monty-Python reference in!
Yep, this looks pretty straightforward to me. One nit, that you can choose to ignore |
Alternative to #11244, where
get_ufunc_arguments
just ensures any object from the kwargs has its own reference. Must say I like this better.