Bug description
netrc does not distinguish an empty quoted token ("") from end-of-file. When an empty token appears where a top-level or follower token is expected, parsing stops successfully and silently ignores the remaining content. It should raise netrc.NetrcParseError instead.
Reproduction code
import netrc
import tempfile
from pathlib import Path
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / "test.netrc"
path.write_text(
'"" invalid\n'
'machine example.com login alice password secret\n',
encoding="utf-8",
)
parsed = netrc.netrc(path)
print(parsed.hosts)
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug description
netrcdoes not distinguish an empty quoted token ("") from end-of-file. When an empty token appears where a top-level or follower token is expected, parsing stops successfully and silently ignores the remaining content. It should raisenetrc.NetrcParseErrorinstead.Reproduction code
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs