Skip to content
This repository was archived by the owner on Jul 16, 2022. It is now read-only.
This repository was archived by the owner on Jul 16, 2022. It is now read-only.

Improve control over line endings #37

@lorengordon

Description

@lorengordon

I noticed that the default mode is w, which in tempfile.NamedTempFile() always converts line endings based on the os.linesep. If I have a data with \n line endings, atom_write() by default converts it to \r\n on Windows. And vice-versa on Linux.

Python 3's open() introduced a new option, newlines to improve control over how line endings are handled. It's available in both Python 3 and Python 2 via io.open().

I can work around the problem by specifying the mode as w+b, but then on Python 3 I also have to make sure the string is encoded as bytes. It would be convenient if this library used io.open and propagated the newline parameter. Setting newline='' then does not perform any translation on line endings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions