]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-116957: configparser: Do post-process values after DuplicateOptionError (GH-116958)
authorDavid Röthlisberger <david@rothlis.net>
Tue, 19 Mar 2024 09:59:08 +0000 (09:59 +0000)
committerGitHub <noreply@github.com>
Tue, 19 Mar 2024 09:59:08 +0000 (11:59 +0200)
commitb1bc37597f0d36084c4dcb15977fe6d4b9322cd4
tree18d75aee9e613b36f202090b8ac370e80c529307
parenta8e93d3dca086896e668b88b6c5450eaf644c0e7
gh-116957: configparser: Do post-process values after DuplicateOptionError (GH-116958)

If you catch DuplicateOptionError / DuplicateSectionError when reading a
config file (the intention is to skip invalid config files) and then
attempt to use the ConfigParser instance, any values it *had* read
successfully so far, were stored as a list instead of string! Later
`get` calls would raise "AttributeError: 'list' object has no attribute
'find'" from somewhere deep in the interpolation code.
Lib/configparser.py
Lib/test/test_configparser.py
Misc/NEWS.d/next/Library/2024-03-18-14-36-50.gh-issue-116957.dTCs4f.rst [new file with mode: 0644]