Bug report
Bug description:
from pathlib import Path
path = Path("foo.txt")
path.write_text("foo\r\nbar")
print(path.read_bytes()) # b'foo\r\r\nbar'
i know i can workaround this behavior by passing newline="" to write_text or using write_bytes instead, but this should not be necessary. it should check whether the text is already using CRLF.
(sidenote: windows has supported LF for many years now. the automatic conversion many tools do by default is not only no longer necessary, but nowadays causes far more problems than it solves IMO. https://old.reddit.com/r/git/comments/7mg1q1/gits_crlf_handling_is_the_source_of_all_modern/)
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
i know i can workaround this behavior by passing
newline=""towrite_textor usingwrite_bytesinstead, but this should not be necessary. it should check whether the text is already using CRLF.(sidenote: windows has supported LF for many years now. the automatic conversion many tools do by default is not only no longer necessary, but nowadays causes far more problems than it solves IMO. https://old.reddit.com/r/git/comments/7mg1q1/gits_crlf_handling_is_the_source_of_all_modern/)
CPython versions tested on:
3.14
Operating systems tested on:
Windows