Skip to content

Commit 524b60e

Browse files
hukkinilevkivskyi
authored and
Ivan Levkivskyi
committed
Disable universal newlines when reading TOML (#10893)
* Disable universal newlines when reading TOML * Update mypy/modulefinder.py Co-authored-by: Taneli Hukkinen <[email protected]> * Update mypy/config_parser.py Co-authored-by: Taneli Hukkinen <[email protected]> Co-authored-by: Ivan Levkivskyi <[email protected]>
1 parent 5a19bfb commit 524b60e

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Diff for: mypy-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
typing_extensions>=3.7.4
22
mypy_extensions>=0.4.3,<0.5.0
33
typed_ast>=1.4.0,<2
4-
tomli>=1.1.0,<1.2.0
4+
tomli>=1.1.0,<2.0.0

Diff for: mypy/config_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def parse_config_file(options: Options, set_strict_flags: Callable[[], None],
169169
try:
170170
if is_toml(config_file):
171171
with open(config_file, encoding="utf-8") as f:
172-
toml_data = tomli.load(f)
172+
toml_data = tomli.loads(f.read())
173173
# Filter down to just mypy relevant toml keys
174174
toml_data = toml_data.get('tool', {})
175175
if 'mypy' not in toml_data:

Diff for: mypy/modulefinder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,8 @@ def _is_compatible_stub_package(self, stub_dir: str) -> bool:
439439
if os.path.isfile(metadata_fnam):
440440
# Delay import for a possible minor performance win.
441441
import tomli
442-
with open(metadata_fnam, 'r', encoding="utf-8") as f:
443-
metadata = tomli.load(f)
442+
with open(metadata_fnam, encoding="utf-8") as f:
443+
metadata = tomli.loads(f.read())
444444
if self.python_major_ver == 2:
445445
return bool(metadata.get('python2', False))
446446
else:

Diff for: setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def run(self):
193193
install_requires=["typed_ast >= 1.4.0, < 2; python_version<'3.8'",
194194
'typing_extensions>=3.7.4',
195195
'mypy_extensions >= 0.4.3, < 0.5.0',
196-
'tomli>=1.1.0,<1.2.0',
196+
'tomli>=1.1.0,<2.0.0',
197197
],
198198
# Same here.
199199
extras_require={'dmypy': 'psutil >= 4.0', 'python2': 'typed_ast >= 1.4.0, < 2'},

0 commit comments

Comments
 (0)