Repository navigation
Return a bool from is_driver() and is_exe() again - #646
Merged
Merged
Conversation
since erocarrera#592 the last line returns the set of matching section names and ( ... ) , so a file with no PAGE section gets set() back instead of False . pe.is_driver() is False is no longer true for most files , and json.dumps() of the result raises TypeError . this is not in a release yet , v2024.8.26 still has the if and return False . wrapping the set in bool() , the same way erocarrera#607 did for has_dynamic_relocs() , puts it back . over the 356 files in pefile-tests every result is a bool now , and none changes its truth value . the new test fails before the change with set() is not False .
the same change in erocarrera#592 made is_exe() return the result of EXE_flag & Characteristics when that is 0 , so a file without IMAGE_FILE_EXECUTABLE_IMAGE gets 0 back instead of False . bool() around it , and the test clears the flag on cmd.exe , which fails before the change with 0 is not False .
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.
#592 turned the
if ... return True/return Falseat the end ofis_driver()andis_exe()into onereturn a and b. the first operand is a set inis_driver()and an int inis_exe(), so when it is empty the function returns it ,set()or0, instead ofFalse:so
pe.is_driver() is Falseis no longer true for most files . v2024.8.26 still has the old code , so this is not in a release yet .the fix wraps the first operand in
bool(), the same way #607 did forhas_dynamic_relocs(). over the 356 files in pefile-tests every result is a bool now and none changes its truth value . the new test fails before each change , withset() is not Falseand0 is not False.