diff options
author | Georg Brandl <georg@python.org> | 2009-04-12 17:26:19 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-04-12 17:26:19 +0000 |
commit | dcfed0e316243b2635ccfee3553eb5eacd3d2135 (patch) | |
tree | c81f131eed099aaf17d512300b47fc72dc0aeb95 /Lib/ConfigParser.py | |
parent | 8a31eba939c8b91a03c03fa80641ef1f0ee53b1a (diff) | |
download | cpython-git-dcfed0e316243b2635ccfee3553eb5eacd3d2135.tar.gz |
Merged revisions 71537 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71537 | georg.brandl | 2009-04-12 19:24:11 +0200 (So, 12 Apr 2009) | 1 line
#5741: dont disallow double percent signs in SafeConfigParser.set() keys.
........
Diffstat (limited to 'Lib/ConfigParser.py')
-rw-r--r-- | Lib/ConfigParser.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py index b6af6f9bab..aa4f196fa4 100644 --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -614,7 +614,6 @@ class SafeConfigParser(ConfigParser): return ''.join(L) _interpvar_re = re.compile(r"%\(([^)]+)\)s") - _badpercent_re = re.compile(r"%[^%]|%$") def _interpolate_some(self, option, accum, rest, section, map, depth): if depth > MAX_INTERPOLATION_DEPTH: @@ -661,9 +660,10 @@ class SafeConfigParser(ConfigParser): # check for bad percent signs: # first, replace all "good" interpolations tmp_value = self._interpvar_re.sub('', value) + tmp_value = tmp_value.replace('%%', '') # then, check if there's a lone percent sign left - m = self._badpercent_re.search(tmp_value) - if m: + percent_index = tmp_value.find('%') + if percent_index != -1: raise ValueError("invalid interpolation syntax in %r at " - "position %d" % (value, m.start())) + "position %d" % (value, percent_index)) ConfigParser.set(self, section, option, value) |