Skip to content

Commit 72b6c36

Browse files
committed
Improve the performance http.cookiejar.join_header_words.
The function does not anymore rely on a regular expression to find alphanumeric characters and underscores.
1 parent ae7f621 commit 72b6c36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/http/cookiejar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def join_header_words(lists):
448448
attr = []
449449
for k, v in pairs:
450450
if v is not None:
451-
if not re.search(r"^\w+$", v):
451+
if not v.isalnum() and '_' not in v:
452452
v = HEADER_JOIN_ESCAPE_RE.sub(r"\\\1", v) # escape " and \
453453
v = '"%s"' % v
454454
k = "%s=%s" % (k, v)

0 commit comments

Comments
 (0)