-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Added kwarg handling to rect.c #3872
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 8000 privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I added and ran tests for all of 8000 these, and they are working across the board, but I'm not sure how best to handle keyword arguments when the function is overloaded in the functions below:
In these cases, arguments could be passed in a number of ways:
I'd imagine most users would expect to be able to pass the arguments in the overloaded functions as well, ie Do you have any recommendations on how to handle kwargs with overloaded functions? |
Very good. I left a few notes for your consideration. As to your question…
Yeah, people will probably want to call them like that. Good point. You add all of the keyword arguments. Then if they are not used they are set to NULL if not used. So you can check the user has done something sensible. Raise a ValueError if an unsupported combination is used. Like x and scale_by but not y. |
Thanks for the suggestion. I've gone ahead and made changes based on your suggestion for I'll go ahead and update the |
Alright, this should all be in working order now (though I'll keep an eye on the automated checks in case there are any compilation errors). Updates:
|
Looks like Python versions over 3.7 are failing the below test cases across the board. I'll take a look next week and try to get that fixed.
|
What do you think about removing the scaleby changes, and then the other stuff can be merged in? |
I found the issue this morning: I accidentally initialised the temporary values as I'm not sure why the handling was different Python 3.8 and higher before, but it looks like everything is passing now in the automated checks except for Ubuntu 3.12dev, but it seems like that is an import error that seems unrelated to these changes?
|
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.
Awesome. Thanks. 🎉🎈
Implemented the below changes to display.c functions (per #3852) to add kwarg support:
Functions covered:
pg_rect_clipline
pg_rect_scale_by
pg_rect_scale_by_ip
pg_rect_unionall
pg_rect_unionall_ip
pg_rect_collidelist
pg_rect_collidelistall
pg_rect_collidedict
pg_rect_collidedictall