-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance of http.cookiejar.join_header_words
#128982
Labels
performance
Performance or resource usage
stdlib
Python modules in the Lib dir
type-feature
A feature request or enhancement
Comments
encukou
pushed a commit
that referenced
this issue
Feb 26, 2025
…er_words` for an efficient alternative (GH-128983) The function does not anymore rely on a regular expression to find alphanumeric characters and underscores.
Thank you! |
This is incorrect change. For example, it produces incorrect results for "foo;_" and "foo_bar". |
Oof, thanks for noticing. |
encukou
added a commit
to encukou/cpython
that referenced
this issue
Feb 26, 2025
…ejar.join_header_words` for an efficient alternative (pythonGH-128983)" This reverts commit 56e1900.
|
I'll close this one and we'll move to 130631 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
performance
Performance or resource usage
stdlib
Python modules in the Lib dir
type-feature
A feature request or enhancement
Feature or enhancement
Proposal:
Currently, we use
if not re.search(r"^\w+$", v):
. This can be replaced byif not v.isalnum() and '_' not in v
. Benchmarks are as follows:It doesn't help having a compiled regex by the way.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
http.cookiejar.join_header_words
for an efficient alternative #128983The text was updated successfully, but these errors were encountered: