summaryrefslogtreecommitdiffstats
path: root/Lib/configparser.py
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2018-06-08 11:02:48 (GMT)
committerGitHub <noreply@github.com>2018-06-08 11:02:48 (GMT)
commit214f18e49feb6a9d6c05aa09a4bb304905e81334 (patch)
treee39653d73ef272826e492d4af2da4261e6ce6dea /Lib/configparser.py
parent66f02aa32f1e4adb9f24cf186f8c495399d5ce9b (diff)
downloadcpython-214f18e49feb6a9d6c05aa09a4bb304905e81334.zip
cpython-214f18e49feb6a9d6c05aa09a4bb304905e81334.tar.gz
cpython-214f18e49feb6a9d6c05aa09a4bb304905e81334.tar.bz2
bpo-33802: Do not interpolate in ConfigParser while reading defaults (GH-7524)
This solves a regression in logging config due to changes in BPO-23835.
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r--Lib/configparser.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py
index c88605f..ea788ae 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -1208,8 +1208,16 @@ class ConfigParser(RawConfigParser):
def _read_defaults(self, defaults):
"""Reads the defaults passed in the initializer, implicitly converting
- values to strings like the rest of the API."""
- self.read_dict({self.default_section: defaults})
+ values to strings like the rest of the API.
+
+ Does not perform interpolation for backwards compatibility.
+ """
+ try:
+ hold_interpolation = self._interpolation
+ self._interpolation = Interpolation()
+ self.read_dict({self.default_section: defaults})
+ finally:
+ self._interpolation = hold_interpolation
class SafeConfigParser(ConfigParser):