Skip to content

Commit 02d6c7a

Browse files
hukkinilevkivskyi
andauthored
Disable universal newlines when reading TOML (#10893)
* Disable universal newlines when reading TOML * Update mypy/modulefinder.py Co-authored-by: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> * Update mypy/config_parser.py Co-authored-by: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
1 parent 3027cd6 commit 02d6c7a

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.10
22
mypy_extensions>=0.4.3,<0.5.0
33
typed_ast>=1.4.0,<2; python_version<'3.8'
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
@@ -172,7 +172,7 @@ def parse_config_file(options: Options, set_strict_flags: Callable[[], None],
172172
try:
173173
if is_toml(config_file):
174174
with open(config_file, encoding="utf-8") as f:
175-
toml_data = tomli.load(f)
175+
toml_data = tomli.loads(f.read())
176176
# Filter down to just mypy relevant toml keys
177177
toml_data = toml_data.get('tool', {})
178178
if 'mypy' not in toml_data:

Diff for: mypy/modulefinder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ def _is_compatible_stub_package(self, stub_dir: str) -> bool:
451451
if os.path.isfile(metadata_fnam):
452452
# Delay import for a possible minor performance win.
453453
import tomli
454-
with open(metadata_fnam, 'r', encoding="utf-8") as f:
455-
metadata = tomli.load(f)
454+
with open(metadata_fnam, encoding="utf-8") as f:
455+
metadata = tomli.loads(f.read())
456456
if self.python_major_ver == 2:
457457
return bool(metadata.get('python2', False))
458458
else:

Diff for: setup.py

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

0 commit comments

Comments
 (0)