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.
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 @@
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):