-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
array_function_dispatch() breaks inspect.getargspec/getfullargspec #12225
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
Comments
Option 4: Roll back |
Testing suggests that this would fix the Dask issue, but something else appears to be causing the pandas issue -- #12226 didn't fix it. @eric-wieser Unfortunately, the mere availability of |
I guess the point of waiting for python3 only is that option (1) becomes more palatable - we can tell users how to solve the introspection problem. p.s. There may be some independent value in not rolling out something major for our last python2 version, which perhaps argues for waiting. Or, maybe more crazily, one could proceed with the wrapper not doing anything by default, i.e., have one release in which even having |
I finally understand exactly what the decorator library is doing. It dynamically creates a function with the appropriate signature, e.g., for def sum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue, initial=np._NoValue):
return _public_api_for_sum(a, axis, dtype, out, keepdims, initial) where The problem with this version of the decorator is that inevitably this breaks extensibility -- implementations of So I think I'm -1 on using decorator now.
Yeah, I'm starting to come around to this option. Another option would be to point users to the |
@shoyer did you delete your own comment from 5 hours ago? I was going to respond to it, but it's not here anymore.
Not crazy - that seems much better than removing everything and putting it back after the 1.16.x branch |
@rgommers It looks like my comment is still there? Maybe some temporary glitch related to the GitHub data outage last night? |
Yes, if there is no way avoid breaking some edge cases it is certainly better to roll this out slowly. It would be a reasonable use-case for @njsmith's |
I think we can close this, as we have the |
xref #12028
Even though assuredly this isn't really guaranteed by our API, introspection into NumPy function arguments appears to be used by a number of our dependencies. Unfortunately, although
inspect.signature
has afollow_wrapped
argument this isn't the case forinspect.getfullargspec
or the oldinspect.getargspec
(still used for Python 2.7 compatibility in many cases).Behavior on master:
Behavior with the released version of NumPy:
This results in test failures in dask (dask/dask#4111) and is my best guess for pandas test failures (pandas-dev/pandas#23172).
We have a few options for fixing this:
eval
/exec
based magic to build real function objects with the right signature Tracking issue for implementation of NEP-18 (__array_function__) #12028 (comment)(1) seems quite unfriendly to users. (3) would result in a lot of more boilerplate code in NumPy and would break extensibility.
(2) might have a negative impact on import performance, but may be our best bet.
The text was updated successfully, but these errors were encountered: