Skip to content

Quote list_values=False values that would not survive a reload - #279

Open
abhijeet117 wants to merge 1 commit into
DiffSK:5.0.xfrom
abhijeet117:fix/list-values-hash-roundtrip
Open

Quote list_values=False values that would not survive a reload#279
abhijeet117 wants to merge 1 commit into
DiffSK:5.0.xfrom
abhijeet117:fix/list-values-hash-roundtrip

Conversation

@abhijeet117

Copy link
Copy Markdown

Summary

With list_values=False, a value containing # was written bare and everything from the # was silently dropped as an inline comment on reload. A value starting with a quote character was written bare and could not be parsed at all on reload. Both broke the round trip of configobj's own output. Such values are now quoted on write and unquoted symmetrically on read; ambiguous quoted lines keep their verbatim text.

Fixes #270

Testing

Reproduced both failures from issue #270 before changing code: hello # world reloaded as hello, and hello world raised a parse error. Added test_list_values_false_written_output_can_be_read_back, which fails on master and passes here. Full suite passes except one pre-existing Windows-only line-ending failure; doctests and python -m configobj.validate pass too.

Checklist

  • Bug reproduced before the fix
  • Root cause identified
  • Bug fixed
  • Tests passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant