Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8ba22b9

Browse filesBrowse files
authored
gh-95865: Speed up urllib.parse.quote_from_bytes() (GH-95872)
1 parent 88671a9 commit 8ba22b9
Copy full SHA for 8ba22b9

File tree

Expand file treeCollapse file tree

2 files changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-1
lines changed

‎Lib/urllib/parse.py

Copy file name to clipboardExpand all lines: Lib/urllib/parse.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ def quote_from_bytes(bs, safe='/'):
906906
if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe):
907907
return bs.decode()
908908
quoter = _byte_quoter_factory(safe)
909-
return ''.join([quoter(char) for char in bs])
909+
return ''.join(map(quoter, bs))
910910

911911
def urlencode(query, doseq=False, safe='', encoding=None, errors=None,
912912
quote_via=quote_plus):
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Speed up :func:`urllib.parse.quote_from_bytes` by replacing a list comprehension with ``map()``.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.