Skip newline in binary mode

This commit is contained in:
Daniel A. Wozniak 2018-08-10 10:02:42 -07:00
parent 2cf80c1595
commit 6cf93e8fc4
No known key found for this signature in database
GPG key ID: 166B9D2C06C82D61

View file

@ -163,7 +163,7 @@ def atomic_open(filename, mode='w'):
'dir': os.path.dirname(filename),
'delete': False,
}
if six.PY3:
if six.PY3 and 'b' not in mode:
kwargs['newline'] = ''
ntf = tempfile.NamedTemporaryFile(mode, **kwargs)
return _AtomicWFile(ntf, ntf.name, filename)