gh-155468: Distinguish empty quoted tokens from EOF in netrc - #155471
Open
lpyu001 wants to merge 1 commit into
Open
gh-155468: Distinguish empty quoted tokens from EOF in netrc#155471lpyu001 wants to merge 1 commit into
lpyu001 wants to merge 1 commit into
Conversation
picnixz
reviewed
Aug 11, 2026
| lexer.instream.readline() | ||
| continue | ||
| if tt in {'', 'machine', 'default', 'macdef'}: | ||
| if tt is None or tt in {'machine', 'default', 'macdef'}: |
Member
There was a problem hiding this comment.
Yu can to "tt in {None, "machine", ...}
picnixz
reviewed
Aug 11, 2026
| break | ||
| elif tt == 'login' or tt == 'user': | ||
| login = lexer.get_token() | ||
| if login is None: |
Member
There was a problem hiding this comment.
I don't think you need thsoe None checks, just do login = lexer.get_token() or ""
picnixz
reviewed
Aug 11, 2026
| def test_empty_quoted_token_is_not_eof(self): | ||
| data = ( | ||
| '"" invalid', | ||
| 'machine host.domain.com "" invalid', |
Member
There was a problem hiding this comment.
also test what happens when you put "" at the end (e.g., machine host.domain.com invalid "") Those should be legitimate cases but they are not tested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.