Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write stubs with utf-8 encoding #16329

Merged
merged 2 commits into from Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/stubgen.py
Expand Up @@ -1578,7 +1578,7 @@ def generate_stub_for_py_module(
subdir = os.path.dirname(target)
if subdir and not os.path.isdir(subdir):
os.makedirs(subdir)
with open(target, "w") as file:
with open(target, "w", encoding="utf-8") as file:
file.write(output)


Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/stubgen.test
Expand Up @@ -3485,7 +3485,7 @@ def f2(): ...
class A:
"""class docstring

a multiline docstring"""
a multiline 😊 docstring"""
def func():
"""func docstring
don't forget to indent"""
Expand All @@ -3512,7 +3512,7 @@ class B:
class A:
"""class docstring

a multiline docstring"""
a multiline 😊 docstring"""
def func() -> None:
"""func docstring
don't forget to indent"""
Expand Down