-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
API: remove undocumented use of __array__(dtype, context) #15118
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
Removed that too |
Note that |
I worry that this perhaps should go through a deprecation cycle. I agree we don't need it though, since Either way, this will need to hit the mailing list, in case there really are users out there. We should probably tag the commit |
Hmmm, I have been silly, right. I would be fine with not going through a deprecation here. But we can actually go through it, right? We can try with the It is too bad, as it seems like just dead overhead to even build the context, but... should we go with a single release deprecation here? |
3073c37
to
4b1fc04
Compare
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.
LGTM, possibly the release notes should note that context
is now ignored in PyArray_FromAny
, and actually, this means that the documentation needs adapting:
The context argument is passed to the __array__ method of op and is only used if the array is constructed that way. Almost always this parameter is NULL.
Should be replaced with void *reserved
the input is currently ignored (maybe with a versionchanged tag
?), or just keep the name, but write that the input is not passed on anymore.
Same for: PyArray_FromArrayAttr
, PyArray_HasArrayInterfaceType
(probably no change needed) and PyArray_CheckFromAny
(if you change the name) and PyArray_GetArrayParamsFromObject
.
In any case, I am in favor of just putting it in, nobody ever answered on the list and things are just simpler if we give it a shot. Lets mention it very briefly on wednesday in case someone disagrees?
adjusting documentation. |
We should make any use of context in the c-api an error. EDIT: Other then that, I think we were fine with going ahead with error/changing the API (in the 15.01.2020 triage meeting call) |
d3c95c0
to
f38504c
Compare
Squashed to a single commit just in case we need to revert. Also actively check that the C-API use is always |
Thanks Matti, hopefully nobody will notice. If anyone does and finds this, please do comment, we are prepared to revert if necessary. |
👋 breakage of rather old and hacky code in casadi project here |
If it's a big deal, I suppose we could change this to a |
it seems my check for using |
Well, we stopped providing context in some cases (specifically ufunc calls), it would be good to know if the context was actually useful here for some reason. The Deprecation will only be on the part of others providing a context manually... What is the |
In 59bd342 the possibility to add a second argument to
__array__
was added, with no documentation and no clear use case. Over time the code was refactored, but that extra argument remained so that the added test would pass. I think we should remove it. I could not find use of this argument in dask, scipy, pandas, cython, or astropy.On first glance, it might be prudent to completely remove
context
fromPyArray_FromArrayAttr
since it is no longer used. Unfortunately, thecontext
argument percolates out ofPyArray_FromArrayAttr
toPyArray_GetArrayParamsFromObject
toPyArray_FromAny
, all of which are API functions so we cannot remove it.On the other hand, that means I can use it fornp.allow_object
xref gh-15083