fix missing code contents that should be included in signature of a f… #3256
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.
…unction action
The code of a python function that is used as a build action is inspected and included in the sconsign signature so the target can be rebuilt if the function changes. However, scons currently does not notice if a constant value in the expression of a list comprehension is changed. This PR fixes that.
In this example:
changing the
2
in the list comprehension intest()
would (incorrectly) not cause a rebuild.The existing code that computes contents of a function (in
_code_contents()
) strips off the first item from theco_consts
tuple. In a function, this first item is the docstring (orNone
if there is no docstring). List comprehension code is not included directly in a function'sco_code
, but appears as an object in theco_consts
tuple, and is processed on a later recursive invocation of_code_contents()
. List comprehensions also have their ownco_consts
tuple, though theirs do not have a docstring (or aNone
placeholder). Removing the first object from theirco_consts
effectively ignores a real constant from the code. This PR changes the logic to only remove values from theco_consts
tuple that equal the docstring, if any.Contributor Checklist:
master/src/CHANGES.txt
directory (and read theREADME.txt
in that directory)