Skip to content

gh-70999: Preserve caller vars in ExtendedInterpolation nested interpolation - #155880

Open
nikolauspschuetz wants to merge 1 commit into
python:mainfrom
nikolauspschuetz:gh-70999-extendedinterpolation-vars
Open

gh-70999: Preserve caller vars in ExtendedInterpolation nested interpolation#155880
nikolauspschuetz wants to merge 1 commit into
python:mainfrom
nikolauspschuetz:gh-70999-extendedinterpolation-vars

Conversation

@nikolauspschuetz

@nikolauspschuetz nikolauspschuetz commented Aug 16, 2026

Copy link
Copy Markdown

ExtendedInterpolation honoured caller-supplied vars only 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 carrying vars, so cfg.get('s', 'a', vars={'c': 'x'}) returned the configured c instead of x.

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, so vars don't leak across sections. Adds a regression test.

Fixes #70999

…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
nikolauspschuetz force-pushed the gh-70999-extendedinterpolation-vars branch from acd5275 to 0ea8e9d Compare August 16, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExtendedInterpolation drops user-defined 'vars' during _interpolate_some() recursion

1 participant