bpo-34132: Fix netrc parsing regression by bbayles · Pull Request #8360 · python/cpython
This PR adds tests and a fix for the issue described in bpo-34132, a strange regression in netrc parsing.
Current versions of Python 3 to fail to parse files like this one:
# Comment
default login user password pass
However, they can parse files like this one:
#Comment
default login user password pass
Python 2 had no such problem - it used negative seeks instead of the lexer's line number counter. Negative seeks don't work in Python 3, but we can use absolute seeks almost as easily.
https://github.com/python/cpython/blob/2.7/Lib/netrc.py#L47-L51
I made another attempt this earlier, but this time I think I managed to avoid introducing a different regression.