Skip to content

Commit f20cb87

Browse files
ashwchgvanrossum
authored andcommitted
Use read_with_python_encoding in stubgen to handle file encoding (#3790)
1 parent a6ddd45 commit f20cb87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypy/stubgen.py

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ def generate_stub(path: str,
200200
pyversion: Tuple[int, int] = defaults.PYTHON3_VERSION,
201201
include_private: bool = False
202202
) -> None:
203-
with open(path, 'rb') as f:
204-
source = f.read()
203+
204+
source, _ = mypy.build.read_with_python_encoding(path, pyversion)
205205
options = MypyOptions()
206206
options.python_version = pyversion
207207
try:

0 commit comments

Comments
 (0)