-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
ENH: Validate dispatcher functions in array_function_dispatch #12099
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
They should have the same signature as the decorated function. Note: eventually these checks should be optional -- we really only need them to be run as part of NumPy's test suite, not every time numpy is imported.
@mhvk lt would be great if you could take a look here |
Test failure is not relevant. Close/open to trigger new tests. |
@shoyer - this looks good. I'm only wondering whether we need the If we do go with the keyword argument, how about Obviously, none of this is a big deal! |
@mhvk I originally omitted the keyword argument, but found it handy when writing decorators for functions that forward to other implementations with signatures like If we do turn this off outside of testing, we should document that I'll switch the keyword argument name to |
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.
OK, actual examples of the keyword being useful definitely win the day! Agreed also that we should not worry about the bit of extra time unless we find it is actually significant. I think this is ready to go in, though perhaps a rebase to a single commit is a good idea.
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.
This looks perfect to me -- There should probably be an evironment variable provided that turns verification on by default. I prefer this so implementations could be kept in line with NumPy when testing without having user code break.
@hameerabbasi Yes, I agree that an environment variable would be the way to go here (especially if/when we make |
Remind me, are we OK using the "Squash and merge" workflow on GitHub? I like it because it puts everything into one atomic commit per pull request, but preserve the history of commits when reviewing a pull request (which is lost when rebasing). I know @charris probably has opinions here. |
Squash and merge is enabled, so we allow it. |
@hameerabbasi @mhvk thanks for reviewing this! |
They should have the same signature as the decorated function.
Note: eventually these checks should be optional -- we really only need them to be run as part of NumPy's test suite, not every time numpy is imported.