Skip to content

Commit c263619

Browse files
committed
Write bytes explicitly
This avoids considerations around universal newlines that were breaking on Windows.
1 parent 98d45b3 commit c263619

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/unasync/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def _unasync_file(self, filepath):
7171
result = _untokenize(tokens)
7272
outfilepath = filepath.replace(self.fromdir, self.todir)
7373
os.makedirs(os.path.dirname(outfilepath), exist_ok=True)
74-
with open(outfilepath, "w", encoding=encoding) as f:
75-
print(result, file=f, end="")
74+
with open(outfilepath, "rw") as f:
75+
f.write(result.encode(encoding))
7676

7777
def _unasync_tokens(self, tokens):
7878
# TODO __await__, ...?

0 commit comments

Comments
 (0)