|
def get_py_project_toml(path): |
|
with open(str(path)) as file_handler: |
|
config_data = toml.load(file_handler) |
toml must be encoded by UTF-8. Please add encoding="utf-8" here.
It may cause UnicodeDecodeError when pyproject.toml contains non-ASCII character and locale encoding is not UTF-8 (e.g. Windows).
|
with TemporaryFile("wt") as file: |
|
with redirect_stdout(file): |
|
with redirect_stderr(file): |
|
yield |
On Windows, stdout is UTF-8 encoded when it is console (e.g. _WinConsoleIO), but the default encoding of TemporaryFile() is legacy encoding. So UTF-8 is better encoding for this purpose.
This is not a real bug because this function is used only here:
tox/src/tox/config/__init__.py
Lines 304 to 306 in 555f3f1
toml must be encoded by UTF-8. Please add
encoding="utf-8"here.It may cause UnicodeDecodeError when pyproject.toml contains non-ASCII character and locale encoding is not UTF-8 (e.g. Windows).
tox/src/tox/util/stdlib.py
Lines 52 to 55 in 555f3f1
On Windows, stdout is UTF-8 encoded when it is console (e.g. _WinConsoleIO), but the default encoding of TemporaryFile() is legacy encoding. So UTF-8 is better encoding for this purpose.
This is not a real bug because this function is used only here:
tox/src/tox/session/__init__.py
Line 54 in cfe38bb