Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coverage/tomlconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def read(self, filenames):
filename = os.fspath(filenames)

try:
with open(filename, encoding='utf-8') as fp:
with open(filename, encoding='utf-8', newline='') as fp:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hukkin do you have a test file that breaks without newline=''?

Copy link
Contributor

Choose a reason for hiding this comment

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

Any file that has a CR character not immediately followed by a LF character. The most simple example is a one byte file with just the CR character (0x0D).

That is invalid TOML and should raise an error, but doesn't if newline='' is not set.

Copy link
Contributor Author

@graingert graingert Jul 30, 2021

Choose a reason for hiding this comment

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

Thanks, I'll push a test case tomorrow

toml_text = fp.read()
except OSError:
return []
Expand Down