Repository navigation
Cleanup C++ code - #17458
Merged
Merged
Cleanup C++ code#17458
Conversation
The Python side seems to always pass the optional arguments, but technically, these should be initialized before calling `PyArg_ParseTupleAndKeywords` in case they aren't.
A new array is always supplied, so just check that it is the right type/shape. Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
It only returns 0 or 1, so bool hold a better meaning here.
anntzer
reviewed
May 20, 2020
anntzer
approved these changes
May 20, 2020
anntzer
left a comment
Contributor
There was a problem hiding this comment.
Haven't actually checked this fixes the memleak, but certainly looks correct.
Member
|
re-milestoned to 3.2.2 as this is in the c++ layer, it is a pretty limited change and the memory leak is pretty bad. |
Member
Author
|
I actually found more things to cleanup from @anntzer's suggestion, and I think there's another leak on 3.2.x that isn't on master, so for 3.2.2, I think I prefer to manually open that PR. |
Member
|
fair enough. |
Also, remove extra `(char*)` casts.
These functions all take `const char *` already, or return `char *` directly.
Member
Author
|
This is a tiny bit more than the image code now, and there are still a bunch of unnecessary |
2 tasks done
Member
|
I also manually confirmed that this fixes the leak. Thanks @QuLogic ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Fixes parsing of input arguments, as optional ones should be given a default value (though the Python side may always provide them), and cleanup the ref counts of
output_arrayusing @anntzer's patch from #15474.Fixes the memory leak due to an extra reference.
PR Checklist