Remove remaining mentions of Python 2
MODIFY
src/urllib3/fields.py
src/urllib3/fields.py
@@ -45,8 +45,6 @@ def format_header_param_rfc2231(name, value):
else:
return result
- # encode_rfc2231 accepts an encoded string and returns an ascii-encoded
- # string in Python 2 but accepts and returns unicode strings in Python 3
value = email.utils.encode_rfc2231(value, "utf-8")
value = f"{name}*={value}"

MODIFY
src/urllib3/poolmanager.py
src/urllib3/poolmanager.py
@@ -327,17 +327,6 @@ class PoolManager(RequestMethods):
self.proxy, self.proxy_config, parsed_url.scheme
)
- def _validate_proxy_scheme_url_selection(self, url_scheme):
- """
- Validates that were not attempting to do TLS in TLS connections on
- Python2 or with unsupported SSL implementations.
- """
- if self.proxy is None or url_scheme != "https":
- return
-
- if self.proxy.scheme != "https":
- return
-
def urlopen(self, method, url, redirect=True, **kw):
"""
Same as :meth:`urllib3.HTTPConnectionPool.urlopen`
@@ -348,7 +337,6 @@ class PoolManager(RequestMethods):
:class:`urllib3.connectionpool.ConnectionPool` can be chosen for it.
"""
u = parse_url(url)
- self._validate_proxy_scheme_url_selection(u.scheme)
conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)

MODIFY
src/urllib3/util/url.py
src/urllib3/util/url.py
@@ -224,7 +224,7 @@ def _encode_invalid_chars(component, allowed_chars):
encoded_component = bytearray()
for i in range(0, len(uri_bytes)):
- # Will return a single character bytestring on both Python 2 & 3
+ # Will return a single character bytestring
byte = uri_bytes[i : i + 1]
byte_ord = ord(byte)
if (is_percent_encoded and byte == b"%") or (

Remove remaining mentions of Python 2