Move from urlparse to parse_url for prepending schemes#5917
Conversation
|
Thanks for this! I've pulled in this patch into our internal monorepo and some preliminary testing shows that it's working (I can |
|
We've rolled this out and it works in prod. |
|
Thanks for checking, @geofft! I think we just need another maintainer to give this a glance and we can look at moving the review forward. |
| # urlparse and parse_url determine that there isn't a netloc present in some | ||
| # urls. We've chosen to assume parsing is being over-cautious, and switch | ||
| # the netloc and path. This is maintained for backwards compatibility. | ||
| netloc = parsed.netloc |
There was a problem hiding this comment.
Uhhh, what? This doesn't make any sense to me, is this something that's only needed for urlparse?
There was a problem hiding this comment.
Yeah, this is only a quirk for urlparse. I'd thought I repro'd with parse_url initially, but I'm unable to now.
I'll reword the whole comment for clarity. I'm not confident the test suite covers all of the initial issue though. I think I'm still in favor of leaving the swap in place as a fallback for anything we're missing.
There was a problem hiding this comment.
@sethmlarson I've reworded things to be a bit clearer.
bfab037 to
ef59aa0
Compare
This addresses the base problem raised in #5855 with the
urlparsechanges in Python 3.9 and potential issues in future 3.7/3.8 releases. We've avoided changing other uses ofurlparsefor now due to issues withparse_url's strict validation requirements when performing parsing.