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

Resolve EncodingWarnings #14676

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Resolve EncodingWarnings #14676

wants to merge 1 commit into from

Conversation

dmtucker
Copy link
Contributor

Resolve #14603

encoding should be explicit, even when opting for the default behavior ("locale")
https://peps.python.org/pep-0597/

This is motivated by eliminating EncodingWarnings in pytest-mypy.

@dmtucker
Copy link
Contributor Author

Would it be appropriate to use "utf-8" instead of "locale" (which isn't added until 3.10)?

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Comment on lines +20 to +23
with NamedTemporaryFile(delete=False) as tmp:
tmp.write(b"x: int = 5\n")
self.tmp_path = Path(tmp.name)
self.tmp_cache_dir = Path(mkdtemp())
Copy link
Collaborator

@A5rocks A5rocks Feb 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will get run before every test in this test suite. Should this get moved into test_default_encoding_warnings?

@jaraco
Copy link
Member

jaraco commented Jun 23, 2023

Would it be appropriate to use "utf-8" instead of "locale" (which isn't added until 3.10)?

In my opinion, "utf-8" almost always the best way to go. It provides more consistency across platforms. Only if the old behavior is truly needed (non-utf8 on Windows platforms) would you likely want "locale".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mypy.api.run causes an EncodingWarning
3 participants