]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-116957: configparser: Do post-process values after DuplicateOptionError...
authorDavid Röthlisberger <david@rothlis.net>
Tue, 19 Mar 2024 17:19:04 +0000 (17:19 +0000)
committerGitHub <noreply@github.com>
Tue, 19 Mar 2024 17:19:04 +0000 (18:19 +0100)
commitb517fd5e1638fc21062476f95cd735341117513b
tree8e7fd3b7794bdbb4e71e1e777d0648f293b13cc1
parentbb7a6d470702a19fc4385a676c90ea941d46888d
[3.11] gh-116957: configparser: Do post-process values after DuplicateOptionError (GH-116958) (GH-117012)

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.

(cherry picked from commit b1bc37597f0d36084c4dcb15977fe6d4b9322cd4)
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]