Merged
Conversation
21b30c1 to
c2ea7b5
Compare
This was referenced Jan 8, 2026
c2ea7b5 to
99e5b3f
Compare
In asp.py and runtimes.py specs are mutated. Most of the "when" specs
are used as keys in dictionaries in PackageBase classes. Mutating their
name means invalidating their hash, leading to subtle issues like
```
spec = Spec("+foo")
specs = {spec}
spec.name = "example"
assert spec in specs # raises
```
This commit fixes that by passing `name` as a function argument.
Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Harmen Stoppels <[email protected]>
e13a4e2 to
126fb76
Compare
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.
Mutating
Spec.nameduring concretization invalidates hash values used in dictionary keys and causes non-local side effects for shared immutable specs (ref #51819). This leads to subtle bugs like these:and
This commit removes the need for mutation by passing the package name as an explicit argument through the ASP generation logic. This was already the status quo for
def _condition_clauses, the same pattern is simply propagated down the function call tree.named_speccontext manager used for temporary renaming.TransformFunctionsignature to(name, spec, facts).namefallback argument tospec_clauses,spec_versions, andtarget_ranges._get_condition_idand_condition_clausesto use explicit names for caching and fact generation.nameargument inspec_clausesinstead of modifying the spec directly.