summaryrefslogtreecommitdiffstats
path: root/Lib/configparser.py
diff options
context:
space:
mode:
authorHugo van Kemenade <hugovk@users.noreply.github.com>2021-09-13 17:12:36 (GMT)
committerGitHub <noreply@github.com>2021-09-13 17:12:36 (GMT)
commit1fc41ae8709e20d741bd86c2345173688a5e84b0 (patch)
treec68e72e63a373fc3730d6d45a1e287026c088227 /Lib/configparser.py
parent85dc53a463967659075744ad911d08a32aa70dd5 (diff)
downloadcpython-1fc41ae8709e20d741bd86c2345173688a5e84b0.zip
cpython-1fc41ae8709e20d741bd86c2345173688a5e84b0.tar.gz
cpython-1fc41ae8709e20d741bd86c2345173688a5e84b0.tar.bz2
bpo-45173 Remove configparser deprecations (GH-28292)
In the configparser module, these have been deprecated since Python 3.2: * the SafeConfigParser class, * the filename property of the ParsingError class, * the readfp method of the ConfigParser class,
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r--Lib/configparser.py45
1 files changed, 1 insertions, 44 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py
index 042a5c7..c10309a 100644
--- a/Lib/configparser.py
+++ b/Lib/configparser.py
@@ -146,13 +146,12 @@ import itertools
import os
import re
import sys
-import warnings
__all__ = ["NoSectionError", "DuplicateOptionError", "DuplicateSectionError",
"NoOptionError", "InterpolationError", "InterpolationDepthError",
"InterpolationMissingOptionError", "InterpolationSyntaxError",
"ParsingError", "MissingSectionHeaderError",
- "ConfigParser", "SafeConfigParser", "RawConfigParser",
+ "ConfigParser", "RawConfigParser",
"Interpolation", "BasicInterpolation", "ExtendedInterpolation",
"LegacyInterpolation", "SectionProxy", "ConverterMapping",
"DEFAULTSECT", "MAX_INTERPOLATION_DEPTH"]
@@ -312,26 +311,6 @@ class ParsingError(Error):
self.errors = []
self.args = (source, )
- @property
- def filename(self):
- """Deprecated, use `source'."""
- warnings.warn(
- "The 'filename' attribute will be removed in future versions. "
- "Use 'source' instead.",
- DeprecationWarning, stacklevel=2
- )
- return self.source
-
- @filename.setter
- def filename(self, value):
- """Deprecated, user `source'."""
- warnings.warn(
- "The 'filename' attribute will be removed in future versions. "
- "Use 'source' instead.",
- DeprecationWarning, stacklevel=2
- )
- self.source = value
-
def append(self, lineno, line):
self.errors.append((lineno, line))
self.message += '\n\t[line %2d]: %s' % (lineno, line)
@@ -754,15 +733,6 @@ class RawConfigParser(MutableMapping):
elements_added.add((section, key))
self.set(section, key, value)
- def readfp(self, fp, filename=None):
- """Deprecated, use read_file instead."""
- warnings.warn(
- "This method will be removed in future versions. "
- "Use 'parser.read_file()' instead.",
- DeprecationWarning, stacklevel=2
- )
- self.read_file(fp, source=filename)
-
def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET):
"""Get an option value for a given section.
@@ -1225,19 +1195,6 @@ class ConfigParser(RawConfigParser):
self._interpolation = hold_interpolation
-class SafeConfigParser(ConfigParser):
- """ConfigParser alias for backwards compatibility purposes."""
-
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- warnings.warn(
- "The SafeConfigParser class has been renamed to ConfigParser "
- "in Python 3.2. This alias will be removed in future versions."
- " Use ConfigParser directly instead.",
- DeprecationWarning, stacklevel=2
- )
-
-
class SectionProxy(MutableMapping):
"""A proxy for a single section from a parser."""