diff --git a/distutils/util.py b/distutils/util.py index 5408b160..aa0c90cf 100644 --- a/distutils/util.py +++ b/distutils/util.py @@ -423,9 +423,9 @@ def byte_compile( # noqa: C901 log.info("writing byte-compilation script '%s'", script_name) if not dry_run: if script_fd is not None: - script = os.fdopen(script_fd, "w") + script = os.fdopen(script_fd, "w", encoding='utf-8') else: - script = open(script_name, "w") + script = open(script_name, "w", encoding='utf-8') with script: script.write(