-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fix segfault in surface.fblits
#2667
Fix segfault in surface.fblits
#2667
Conversation
XDECREF -> DECREF
89fdff8
to
a87d631
Compare
Also with these changes in place it's possible to wrap most of the functionality of both cases (lists/tuples and generators) in a single helper function, thus reducing repetition (call one function in two places), should that be done in this PR or a separate one? |
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! I guess we could do it either way, so it's your choice.
Alright then, since this PR focuses on fixing a bug, I will submit another PR focusing on code robustness once this gets merged. |
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 🥳
Fix segfault in `surface.fblits`
Moved reference decrementing to after the values are used for stuff (see https://docs.python.org/3/c-api/iter.html#c.PyIter_Next).
I'm not sure why this wasn't causing issues for like actual tuples like
(0, 0)
being used directly for the destination, but it appears this was related to the object being passed having to get an attribute dynamically? Not entirely sure, but the segfault seems to have gone away.MRE: