gh-70999: Preserve caller vars in ExtendedInterpolation nested interpolation - #155880
Open
nikolauspschuetz wants to merge 1 commit into
Open
gh-70999: Preserve caller vars in ExtendedInterpolation nested interpolation#155880nikolauspschuetz wants to merge 1 commit into
nikolauspschuetz wants to merge 1 commit into
Conversation
…interpolation ExtendedInterpolation honoured caller-supplied ``vars`` only at the first level of interpolation. When a value referenced another option in the same section, the recursive call rebuilt the lookup map from ``parser.items(section, raw=True)``, discarding the map that carried ``vars``. Mirror BasicInterpolation, which threads the same ``(section, map)`` through recursion, by reusing ``map`` when the reference stays in the current section and only rebuilding it when crossing into another section (so ``vars`` do not leak across sections).
nikolauspschuetz
force-pushed
the
gh-70999-extendedinterpolation-vars
branch
from
August 16, 2026 03:35
acd5275 to
0ea8e9d
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.
ExtendedInterpolationhonoured caller-suppliedvarsonly at the first interpolation level. When a value referenced another option in the same section (e.g.a=${b},b=${c}), the recursive call rebuilt its lookup map from the section and dropped the one carryingvars, socfg.get('s', 'a', vars={'c': 'x'})returned the configuredcinstead ofx.Reuse the caller's map for same-section references — mirroring
BasicInterpolation, which already threads the same map through recursion — and only rebuild it when crossing into another section, sovarsdon't leak across sections. Adds a regression test.Fixes #70999