mirror of https://github.com/python/cpython
gh-95865: Speed up urllib.parse.quote_from_bytes() (GH-95872)
This commit is contained in:
parent
88671a9d69
commit
8ba22b90ca
|
@ -906,7 +906,7 @@ def quote_from_bytes(bs, safe='/'):
|
|||
if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe):
|
||||
return bs.decode()
|
||||
quoter = _byte_quoter_factory(safe)
|
||||
return ''.join([quoter(char) for char in bs])
|
||||
return ''.join(map(quoter, bs))
|
||||
|
||||
def urlencode(query, doseq=False, safe='', encoding=None, errors=None,
|
||||
quote_via=quote_plus):
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Speed up :func:`urllib.parse.quote_from_bytes` by replacing a list comprehension with ``map()``.
|
Loading…
Reference in New Issue