Print all warnings with error_on_warning#157
Merged
Merged
Conversation
regeciovad
force-pushed
the
warnings
branch
from
September 23, 2020 06:31
d6ac93b to
a8a63c8
Compare
plusvic
requested changes
Oct 1, 2020
| } | ||
| else | ||
| { | ||
| PyObject* warnings = (PyObject*)user_data; |
Member
There was a problem hiding this comment.
After this change we don't need to separate functions raise_exception_on_error and raise_exception_on_error_or_warning. The raise_exception_on_error function can raise the exception in case of error and put warnings in the list.
Contributor
Author
There was a problem hiding this comment.
OK, I joined these to functions into a one.
| { | ||
| PyErr_SetObject(YaraWarningError, warnings); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
The reference count for the warnings list is not decremented when PyList_Size(warnings) == 0, causing a memory leak. When PyList_Size(warnings) > 0 apparently PyErr_SetObject takes ownership of the list and you don't need decrement the reference count, but I would double check.
Contributor
Author
There was a problem hiding this comment.
Thanks, I missed that case.
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.
Print all warnings in
yara.compile, not only one, when theerror_on_warningoption is set toTrue.