Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
bpo-45173: Note these configparser deprecations will be removed in 3.12
  • Loading branch information
hugovk committed Jan 27, 2022
commit b06e9ba398fafe39028c3b2dc3943266a16b1416
10 changes: 10 additions & 0 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,16 @@ Deprecated
as deprecated, its docstring is now corrected).
(Contributed by Hugo van Kemenade in :issue:`45837`.)

* The following have been deprecated in :mod:`configparser` since Python 3.2.
Their deprecation warnings have now been updated to note they will removed in
Python 3.12:

* the :class:`configparser.SafeConfigParser` class
* the :attr:`configparser.ParsingError.filename` property
* the :meth:`configparser.ParsingError.readfp` method

(Contributed by Hugo van Kemenade in :issue:`45173`.)

Removed
=======

Expand Down
8 changes: 4 additions & 4 deletions Lib/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def __init__(self, source=None, filename=None):
def filename(self):
"""Deprecated, use `source'."""
warnings.warn(
"The 'filename' attribute will be removed in future versions. "
"The 'filename' attribute will be removed in Python 3.12. "
"Use 'source' instead.",
DeprecationWarning, stacklevel=2
)
Expand All @@ -326,7 +326,7 @@ def filename(self):
def filename(self, value):
"""Deprecated, user `source'."""
warnings.warn(
"The 'filename' attribute will be removed in future versions. "
"The 'filename' attribute will be removed in Python 3.12. "
"Use 'source' instead.",
DeprecationWarning, stacklevel=2
)
Expand Down Expand Up @@ -757,7 +757,7 @@ def read_dict(self, dictionary, source='<dict>'):
def readfp(self, fp, filename=None):
"""Deprecated, use read_file instead."""
warnings.warn(
"This method will be removed in future versions. "
"This method will be removed in Python 3.12. "
"Use 'parser.read_file()' instead.",
DeprecationWarning, stacklevel=2
)
Expand Down Expand Up @@ -1232,7 +1232,7 @@ 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."
"in Python 3.2. This alias will be removed in Python 3.12."
" Use ConfigParser directly instead.",
DeprecationWarning, stacklevel=2
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Note the configparser deprecations will be removed in Python 3.12.