This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove configparser deprecations
Type: Stage: patch review
Components: Library (Lib) Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: gregory.p.smith, hugovk, lukasz.langa, miss-islington, vstinner
Priority: deferred blocker Keywords: patch

Created on 2021-09-11 18:10 by hugovk, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 28292 merged hugovk, 2021-09-11 18:13
PR 30952 merged hugovk, 2022-01-27 09:51
PR 31084 merged hugovk, 2022-02-02 17:31
Messages (10)
msg401644 - (view) Author: Hugo van Kemenade (hugovk) * (Python triager) Date: 2021-09-11 18:10
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,

They can be removed in Python 3.11.
msg401645 - (view) Author: Hugo van Kemenade (hugovk) * (Python triager) Date: 2021-09-11 18:14
Also, the LegacyInterpolation class is deprecated since Python 3.2 but with no DeprecationWarning.

A quick sampling of GitHub results shows only copies of CPython's configparser.py and test_configparser.py

https://github.com/search?l=Python&p=1&q=LegacyInterpolation+extension%3Apy+language%3APython+language%3APython&ref=advsearch&type=Code

No use found in the top 200 PyPI packages.

Is it safe to remove now, or should it raise DeprecationWarning for a couple of releases first?
msg401715 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-13 17:12
New changeset 1fc41ae8709e20d741bd86c2345173688a5e84b0 by Hugo van Kemenade in branch 'main':
bpo-45173 Remove configparser deprecations (GH-28292)
https://github.com/python/cpython/commit/1fc41ae8709e20d741bd86c2345173688a5e84b0
msg409685 - (view) Author: Hugo van Kemenade (hugovk) * (Python triager) Date: 2022-01-04 15:02
Searching 4,764 sdists from the top 5,000 PyPI packages, these 13 contain "LegacyInterpolation":

configparser-5.1.0.tar.gz
configparser2-4.0.0.tar.gz
eth_abi-2.1.1.tar.gz
eth-account-0.5.6.tar.gz
eth-hash-0.3.2.tar.gz
eth-utils-1.10.0.tar.gz
hexbytes-0.2.2.tar.gz
jedi-0.18.1.tar.gz
magicinvoke-2.4.5.tar.gz
mypy-0.910.tar.gz
pytype-2021.11.12.tar.gz
web.py-0.62.tar.gz
webcolors-1.11.1.tar.gz


The first two are stdlib backports: configparser is active and configparser2 was last updated in 2015:

configparser-5.1.0/src/backports/configparser/__init__.py:    "LegacyInterpolation",
configparser-5.1.0/src/backports/configparser/__init__.py:class LegacyInterpolation(Interpolation):
configparser-5.1.0/src/configparser.py:    "LegacyInterpolation",
configparser-5.1.0/src/configparser.py:    LegacyInterpolation,
configparser-5.1.0/src/test_configparser.py:        elif isinstance(self.interpolation, configparser.LegacyInterpolation):
configparser-5.1.0/src/test_configparser.py:        elif isinstance(self.interpolation, configparser.LegacyInterpolation):
configparser-5.1.0/src/test_configparser.py:        elif isinstance(self.interpolation, configparser.LegacyInterpolation):
configparser-5.1.0/src/test_configparser.py:    interpolation = configparser.LegacyInterpolation()
configparser-5.1.0/src/test_configparser.py:class ConfigParserTestCaseLegacyInterpolation(ConfigParserTestCase, unittest.TestCase):

configparser2-4.0.0/src/backports/configparser2/__init__.py:class LegacyInterpolation(Interpolation):
configparser2-4.0.0/src/configparser2.py:    LegacyInterpolation,


The others are all configparser.pyi typeshed stub files:

eth_abi-2.1.1/venv/lib/python3.6/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth_abi-2.1.1/venv/lib64/python3.6/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv-py3.8/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv-py3.8/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv-py3.8/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv-py3.8/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-account-0.5.6/venv/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv-py3.8/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv-py3.8/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv-py3.8/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv-py3.8/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-hash-0.3.2/venv/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv-py3.8/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv-py3.8/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv-py3.8/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv-py3.8/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
eth-utils-1.10.0/venv/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv-py3.8/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv-py3.8/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv-py3.8/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv-py3.8/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv/lib/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv/lib/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv/lib64/python3.8/site-packages/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
hexbytes-0.2.2/venv/lib64/python3.8/site-packages/mypy/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
jedi-0.18.1/jedi/third_party/typeshed/stdlib/3/configparser.pyi:class LegacyInterpolation(Interpolation): ...
mypy-0.910/mypy/typeshed/stdlib/configparser.pyi:class LegacyInterpolation(Interpolation):
pytype-2021.11.12/pytype/typeshed/stdlib/configparser.pyi:class LegacyInterpolation(Interpolation):
msg411810 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-01-26 23:36
Per https://mail.python.org/archives/list/python-dev@python.org/thread/GJTREADEXYAETECE5JDTPYWK4WMTKYGR/ we want to revert https://github.com/python/cpython/commit/1fc41ae8709e20d741bd86c2345173688a5e84b0 for 3.11 to avoid causing pain.

per that thread and https://discuss.python.org/t/experience-with-python-3-11-in-fedora/12911 it sounds like you may be on top of filing upstream issues/PRs to get OSS projects to stop using the deprecated APIs.  great!  that should help this stick in 3.12.

as the commit removed several things at once, I suggest a full rollback, and smaller PRs for individual things if your upstream python project testing reveals things that nobody appears to be depending on.
msg412327 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-02-02 02:07
> Searching 4,764 sdists from the top 5,000 PyPI packages, these 13 contain "LegacyInterpolation"

Other removed symbols are causing troubles, like SafeConfigParser.

Example of Fedora bz #2025600: mom fails to build with Python 3.11: AttributeError: module 'configparser' has no attribute 'SafeConfigParser'.

=> https://bugzilla.redhat.com/show_bug.cgi?id=2025600

Another example: python-iniparse fails to build with Python 3.11: AttributeError: 'RawConfigParser' object has no attribute 'readfp'

https://bugzilla.redhat.com/show_bug.cgi?id=2019017

You can try to unfold https://bugzilla.redhat.com/buglist.cgi?bug_id=2016048&bug_id_type=anddependson&format=tvp and search for "configparser".
msg412328 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-02-02 02:10
Currently, the issue title is "Remove configparser deprecations".

GH-30927 doesn't remove deprecated functions, but adds new warnings. It's really confusing to make this change as part of this issue.

Can you please create a new issue for GH-30927 "bpo-45173: Add DeprecationWarning to LegacyInterpolation"? If it's removed, it's not going to be removed before Python 3.13, so it's not directly related to this issue. By the way, it would be nice explain the rationale for removing it.
msg412340 - (view) Author: Hugo van Kemenade (hugovk) * (Python triager) Date: 2022-02-02 07:11
Sure, please see https://bugs.python.org/issue46607.

I've rebased GH-30927 to use the new issue number.
msg412379 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2022-02-02 16:59
New changeset e8659b47dece5a272111c0af5e340c364a9f807b by Hugo van Kemenade in branch 'main':
bpo-45173: Keep configparser deprecations until Python 3.12 (GH-30952)
https://github.com/python/cpython/commit/e8659b47dece5a272111c0af5e340c364a9f807b
msg412390 - (view) Author: miss-islington (miss-islington) Date: 2022-02-02 18:41
New changeset ba4d79af32b6bb8378cb7003f67d6c4d413fbe89 by Hugo van Kemenade in branch '3.10':
[3.10] bpo-45173: Note configparser deprecations will be removed in 3.12 (GH-31084)
https://github.com/python/cpython/commit/ba4d79af32b6bb8378cb7003f67d6c4d413fbe89
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89336
2022-02-02 18:41:39miss-islingtonsetnosy: + miss-islington
messages: + msg412390
2022-02-02 17:31:45hugovksetpull_requests: + pull_request29268
2022-02-02 16:59:47gregory.p.smithsetmessages: + msg412379
2022-02-02 07:11:00hugovksetmessages: + msg412340
2022-02-02 07:10:02hugovksetpull_requests: - pull_request29106
2022-02-02 02:10:47vstinnersetmessages: + msg412328
2022-02-02 02:07:12vstinnersetnosy: + vstinner
messages: + msg412327
2022-01-27 09:51:32hugovksetstage: needs patch -> patch review
pull_requests: + pull_request29131
2022-01-26 23:36:03gregory.p.smithsetpriority: normal -> deferred blocker

nosy: + gregory.p.smith
messages: + msg411810

stage: patch review -> needs patch
2022-01-26 21:22:05hugovksetpull_requests: + pull_request29106
2022-01-04 15:02:10hugovksetmessages: + msg409685
2021-09-13 17:12:44lukasz.langasetnosy: + lukasz.langa
messages: + msg401715
2021-09-11 18:14:38hugovksetmessages: + msg401645
2021-09-11 18:13:17hugovksetkeywords: + patch
stage: patch review
pull_requests: + pull_request26708
2021-09-11 18:10:39hugovkcreate