Revert to using a copy of splituser from Python 3.8. #1670
Merged
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.
Using urllib.parse.urlparse is clumsy and causes problems as reported in #1663 and #1668. Alternative to #1499 and fixes #1668.
Summary of changes
In #1499, we learned that Python deprecated splituser here and that the recommended change was to use
urllib.parse.urlparse
. However, as we saw in the original patch and later in regressions, in both places wheresplituser
was previously used, the use ofurllib.parse.urlparse
doesn't satisfy the needs thatsplituser
did.So this PR steals the latest implementation of splituser from the Python 3.8 source and uses it instead, largely reverting the changes from #1501 and #1666.
I note that this change restores a flaw in the logic for
open_with_auth
: ifscheme
is nothttp/s
,address
(formerlyhost
) is never defined, but if auth is found in PyPIConfig, aNameError
could occur on line 1072 becauseaddress
isn't defined. Since this flaw existed in the old code and didn't cause any issues, I'm not interested in fixing it.Closes #1668
Pull Request Checklist