{"action":"created","issue":{"url":"https://api.github.com/repos/untitaker/python-atomicwrites/issues/37","repository_url":"https://api.github.com/repos/untitaker/python-atomicwrites","labels_url":"https://api.github.com/repos/untitaker/python-atomicwrites/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/untitaker/python-atomicwrites/issues/37/comments","events_url":"https://api.github.com/repos/untitaker/python-atomicwrites/issues/37/events","html_url":"https://github.com/untitaker/python-atomicwrites/issues/37","id":353394729,"node_id":"MDU6SXNzdWUzNTMzOTQ3Mjk=","number":37,"title":"Improve control over line endings","user":{"login":"lorengordon","id":8457307,"node_id":"MDQ6VXNlcjg0NTczMDc=","avatar_url":"https://avatars3.githubusercontent.com/u/8457307?v=4","gravatar_id":"","url":"https://api.github.com/users/lorengordon","html_url":"https://github.com/lorengordon","followers_url":"https://api.github.com/users/lorengordon/followers","following_url":"https://api.github.com/users/lorengordon/following{/other_user}","gists_url":"https://api.github.com/users/lorengordon/gists{/gist_id}","starred_url":"https://api.github.com/users/lorengordon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorengordon/subscriptions","organizations_url":"https://api.github.com/users/lorengordon/orgs","repos_url":"https://api.github.com/users/lorengordon/repos","events_url":"https://api.github.com/users/lorengordon/events{/privacy}","received_events_url":"https://api.github.com/users/lorengordon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-23T14:00:45Z","updated_at":"2018-08-23T15:16:12Z","closed_at":null,"author_association":"NONE","body":"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.\r\n\r\nPython 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()`. \r\n\r\n* https://docs.python.org/3/library/functions.html#open\r\n\r\nI 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."},"comment":{"url":"https://api.github.com/repos/untitaker/python-atomicwrites/issues/comments/415455518","html_url":"https://github.com/untitaker/python-atomicwrites/issues/37#issuecomment-415455518","issue_url":"https://api.github.com/repos/untitaker/python-atomicwrites/issues/37","id":415455518,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTQ1NTUxOA==","user":{"login":"lorengordon","id":8457307,"node_id":"MDQ6VXNlcjg0NTczMDc=","avatar_url":"https://avatars3.githubusercontent.com/u/8457307?v=4","gravatar_id":"","url":"https://api.github.com/users/lorengordon","html_url":"https://github.com/lorengordon","followers_url":"https://api.github.com/users/lorengordon/followers","following_url":"https://api.github.com/users/lorengordon/following{/other_user}","gists_url":"https://api.github.com/users/lorengordon/gists{/gist_id}","starred_url":"https://api.github.com/users/lorengordon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorengordon/subscriptions","organizations_url":"https://api.github.com/users/lorengordon/orgs","repos_url":"https://api.github.com/users/lorengordon/repos","events_url":"https://api.github.com/users/lorengordon/events{/privacy}","received_events_url":"https://api.github.com/users/lorengordon/received_events","type":"User","site_admin":false},"created_at":"2018-08-23T15:16:12Z","updated_at":"2018-08-23T15:16:12Z","author_association":"NONE","body":"Went ahead with the second approach in #38..."}}
{"actor":{"display_login":"lorengordon"}}