Skip to content

Read pyproject.toml with correct encoding on Windows. #12105

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

Merged
merged 2 commits into from
Feb 1, 2022
Merged

Read pyproject.toml with correct encoding on Windows. #12105

merged 2 commits into from
Feb 1, 2022

Conversation

domdfcoding
Copy link
Contributor

Description

On Windows (where the default encoding for open is usually not UTF-8), attempting to load mypy's configuration from a pyproject.toml fails due to being unable to decode unicode characters. With this patch, the file is read with UTF-8 as the encoding on all platforms.

Fixes #11058

Test Plan

Added a test which loads mypy's configuration from a pyproject.toml file containing non-ASCII characters.

@domdfcoding domdfcoding marked this pull request as ready for review January 31, 2022 14:21
@domdfcoding domdfcoding changed the title Config unicode Read pyproject.toml with correct encoding on Windows. Jan 31, 2022
Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@hauntsaninja hauntsaninja merged commit c0e49ab into python:master Feb 1, 2022
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.

UnicodeDecodeError on Windows with pyproject.toml
2 participants