-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
Improved Surface.fill
error message for invalid blend flags
#2434
Improved Surface.fill
error message for invalid blend flags
#2434
Conversation
Is code robustness an appropriate label in this case? |
Maybe it should say "given blend flag is not supported for this operation" instead? |
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, thanks for the PR!
Some other notes up for discussion, but IMO none blockers for this PR
- Maybe a small unit test would be nice
- Should the python error returned be a
ValueError
?
@ankith26 Lines 1857 to 1858 in 0168adc
to check for that value and raise a separate error. But that would make more sense I guess. I will add a test though, since currently I couldn't find any that would test for any errors raised by |
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!
What if you set the error message with |
That is what the first commit did, however, Ankith suggested raising a ValueError and I thought it would be more suitable too, so changed to that. |
I think this should be an SDL error, since it should look like it's coming from an SDL fill system. Just like how in alphablit.c we implement a blitter and use SDL_SetError there. |
Updated tests Changing back to an sdl error Changed to raise a ValueError, added tests formatting
773ab0f
to
458e92f
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.
I'm fine with pygame.error
Test code:
Currently it either simply raises a
pygame.error
without any error message or I have managed to getSurface doesn't have a colorkey
in this case: