[New-bugs-announce] [issue26812] ExtendedInterpolation drops user-defined 'vars' during _interpolate_some() recursion
Yih-En Andrew Ban
report at bugs.python.org
Thu Apr 21 00:27:19 EDT 2016
New submission from Yih-En Andrew Ban:
In Python 3.5.1, configparser.ExtendedInterpolation will drop the user-defined 'vars' passed in via ConfigParser.get(vars=...) due to a bug when recursing beyond depth 1 in ExtendedInterpolation._interpolate_some(). Line 509 of configparser.py currently reads: 'dict(parser.items(sect, raw=True))' This appears to be a mistake and should instead be: 'map', which includes the user-defined vars.
The following code will trigger an InterpolationMissingOptionError without the fix, and runs as expected with the fix:
from configparser import *
parser = ConfigParser( interpolation=ExtendedInterpolation() )
parser.add_section( 'Section' )
parser.set( 'Section', 'first', '${userdef}' )
parser.set( 'Section', 'second', '${first}' )
parser[ 'Section' ].get( 'second', vars={'userdef': 'userval'} )
----------
components: Library (Lib)
messages: 263876
nosy: lukasz.langa, yab-arz
priority: normal
severity: normal
status: open
title: ExtendedInterpolation drops user-defined 'vars' during _interpolate_some() recursion
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26812>
_______________________________________
More information about the New-bugs-announce
mailing list