-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Prevent abuse of kwargs in stat functions #12318
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
Suggestions on where I could place tests to make sure such an issue doesn't crop up again? Tried finding a place, but no one place really stood out to me. |
tests/frame/test_analytics.py |
or maybe better in test_generic.py (if you place it in Generic then it will be run for each of the structures) |
compat_args = ['out', 'dtype'] | ||
list(map(kwargs.__delitem__, filter( | ||
kwargs.__contains__, compat_args))) | ||
if kwargs: |
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.
can you put this in a helper function (you can pass kwargs
and parameterize the compat_args
if you want)
maybe _assert_valid_kwargs
or something
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.
Done.
@jreback : Off topic, but I noticed that there's a MASSIVE queue on Travis right now. There seem to be a ton of duplicate builds that could be cancelled. |
its actually progressing, travis was down most of today. |
your builds occur independently of pandas FYI |
Ah, I see. Also, I like the suggestion for |
c1a1645
to
2276647
Compare
lgtm. ping when green. |
pls add a whatsnew entry (you can put in API changes) |
c63b936
to
1fc24a1
Compare
Filters kwargs argument in stat functions to prevent the passage of clearly invalid arguments while at the same time maintaining compatibility with analogous numpy functions. Closes pandas-devgh-12301.
1fc24a1
to
f9de80f
Compare
@jreback : Travis is happy again. Good to merge if there's nothing else. |
Addresses issue #12301 by filtering
kwargs
argument in stat functions to prevent the passage of clearly invalid arguments while at the same time maintaining compatibility with analogousnumpy
functions.