I believe it's parsing the line without treating the quotation marks any differently from other non-whitespace characters. So this:
machine "### comment"
gets turned into the tokens machine
, "###
, and comment"
. After that, it can't find any more tokens, and it barfs.
Unfortunately, since there are lots of netrc parsers out there and they might all have different handling of edge cases, you can't really even solve this by writing your own parser unless you can get that parser used by your favorite tools (curl, pip, etc.).
As a further aside on comments, apparently the Python netrc
module will recognize # machine ...
(with a space) but not #machine ...
(without a space) as a comment line. The latter results in various errors like netrc.NetrcParseError: bad toplevel token '...'
, which tools like pip
seem to hide from you, pretending there are no entries in the file.