summaryrefslogtreecommitdiffstats
path: root/Lib/configparser.py
diff options
context:
space:
mode:
authorHugo van Kemenade <hugovk@users.noreply.github.com>2022-04-05 15:15:11 (GMT)
committerGitHub <noreply@github.com>2022-04-05 15:15:11 (GMT)
commit75280944e5ca957eec7f814b9d0608fc84fc5811 (patch)
tree879559411334a9000cd26cb9d8913519fa7e558a /Lib/configparser.py
parentcfb849a326e52a4edc577112ebf60e1d9d0d7fdb (diff)
downloadcpython-75280944e5ca957eec7f814b9d0608fc84fc5811.zip
cpython-75280944e5ca957eec7f814b9d0608fc84fc5811.tar.gz
cpython-75280944e5ca957eec7f814b9d0608fc84fc5811.tar.bz2
bpo-46607: Add DeprecationWarning for LegacyInterpolation, deprecated in docs since 3.2 (GH-30927)
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r--Lib/configparser.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py
index f5666f5..de9ee53 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -525,6 +525,15 @@ class LegacyInterpolation(Interpolation):
_KEYCRE = re.compile(r"%\(([^)]*)\)s|.")
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ warnings.warn(
+ "LegacyInterpolation has been deprecated since Python 3.2 "
+ "and will be removed from the configparser module in Python 3.13. "
+ "Use BasicInterpolation or ExtendedInterpolation instead.",
+ DeprecationWarning, stacklevel=2
+ )
+
def before_get(self, parser, section, option, value, vars):
rawval = value
depth = MAX_INTERPOLATION_DEPTH