Skip to content

Commit c0e49ab

Browse files
authored
Read pyproject.toml with correct encoding on Windows (python#12105)
1 parent 3b331b3 commit c0e49ab

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

mypy/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def find_config_file_line_number(path: str, section: str, setting_name: str) ->
511511
in_desired_section = False
512512
try:
513513
results = []
514-
with open(path) as f:
514+
with open(path, encoding="UTF-8") as f:
515515
for i, line in enumerate(f):
516516
line = line.strip()
517517
if line.startswith('[') and line.endswith(']'):

test-data/unit/cmdline.pyproject.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,11 @@ i: int = 0
125125
This isn't even syntatically valid!
126126
[file x/please_skipme_.py]
127127
Neither is this!
128+
129+
[case testPyprojectTOMLUnicode]
130+
# cmd: mypy x.py
131+
[file pyproject.toml]
132+
\[project]
133+
description = "Factory ⸻ A code generator 🏭"
134+
\[tool.mypy]
135+
[file x.py]

0 commit comments

Comments
 (0)