You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
configparser: write() silently drops leading whitespace from multiline values on round-trip #161317
_write_section adds \n\t to mark continuation lines. On read, _handle_continuation_line calls .strip() on each line — which strips both the added tab AND any whitespace that was part of the original value.
On 3.14+, write() should raise InvalidWriteError here, same as it already does for keys with leading whitespace (gh-96239). On earlier versions the data is just silently lost.
this is reproducible on all 3.13, 3.14, 3.15 and main`. I have a fix ready for this and would love to have a PR for this after it got triaged by maintainers.
Activity
BHUVANSH855 commentedon Nov 4, 2026
this is reproducible on all
3.13,3.14,3.15and main`. I have a fix ready for this and would love to have a PR for this after it got triaged by maintainers.NekoAsakura commentedon Nov 4, 2026
This is documented behaviour, not a bug. See https://docs.python.org/3/library/configparser.html#supported-ini-file-structure.