-
-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
Description
#149 introduced a regression especially for Windows users. If your toml file contains only windows line endings ("\r\n"), you may get mixed line endings when you read, change and write the toml file.
Example:
toml_path = str(tmpdir / "pyproject.toml")
with open(toml_path, "wb+") as f:
f.write(b"a = 1\r\nb = 2\r\n")
f = TOMLFile(toml_path)
content = f.read()
content["c"] = 3
f.write(content)
with open(toml_path, "rb") as f:
print(f.read())
Output: b'a = 1\r\nb = 2\r\nc = 3\n' (the last line ending is "\n" instead of "\r\n")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels