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

Disable universal newlines when reading TOML #10893

Merged
merged 6 commits into from Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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-requirements.txt
@@ -1,4 +1,4 @@
typing_extensions>=3.7.4
mypy_extensions>=0.4.3,<0.5.0
typed_ast>=1.4.0,<1.5.0
tomli>=1.1.0,<1.2.0
tomli>=1.1.0,<2.0.0
2 changes: 1 addition & 1 deletion mypy/config_parser.py
Expand Up @@ -168,7 +168,7 @@ def parse_config_file(options: Options, set_strict_flags: Callable[[], None],
continue
try:
if is_toml(config_file):
with open(config_file, encoding="utf-8") as f:
with open(config_file, "rb") as f:
toml_data = tomli.load(f)
ilevkivskyi marked this conversation as resolved.
Show resolved Hide resolved
# Filter down to just mypy relevant toml keys
toml_data = toml_data.get('tool', {})
Expand Down
2 changes: 1 addition & 1 deletion mypy/modulefinder.py
Expand Up @@ -434,7 +434,7 @@ def _is_compatible_stub_package(self, stub_dir: str) -> bool:
if os.path.isfile(metadata_fnam):
# Delay import for a possible minor performance win.
import tomli
with open(metadata_fnam, 'r', encoding="utf-8") as f:
with open(metadata_fnam, 'rb') as f:
metadata = tomli.load(f)
ilevkivskyi marked this conversation as resolved.
Show resolved Hide resolved
if self.python_major_ver == 2:
return bool(metadata.get('python2', False))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -193,7 +193,7 @@ def run(self):
install_requires=["typed_ast >= 1.4.0, < 1.5.0; python_version<'3.8'",
'typing_extensions>=3.7.4',
'mypy_extensions >= 0.4.3, < 0.5.0',
'tomli>=1.1.0,<1.2.0',
'tomli>=1.1.0,<2.0.0',
],
# Same here.
extras_require={'dmypy': 'psutil >= 4.0', 'python2': 'typed_ast >= 1.4.0, < 1.5.0'},
Expand Down