This is an archive of the discontinued Mercurial Phabricator instance.

url: always use str for proxy configuration
ClosedPublic

Authored by indygreg on Feb 12 2019, 5:37 PM.

Details

Summary

Previously, proxies didn't work on Python 3 for various reasons.

First, the keys to the "proxies" dict are fed into a
setattr(self, "%s_open", ...) call and passing bytestrings
results in setting an oddly named attribute due to the b''
in %s formatting. This resulted in "http_open" and "https_open"
not being properly overridden and proxies not being used.

Second, the standard library was expecting proxy URLs to be
str. And various operations (including our custom code in
url.py) would fail to account for the str/bytes mismatch.

This commit normalizes everything to str and adjusts our
proxy code in url.py to account for the presence of str
on Python 3.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Feb 12 2019, 5:37 PM
This revision was automatically updated to reflect the committed changes.