Opened 5 years ago
Last modified 5 years ago
#31311 closed Cleanup/optimization
Unneeded escape sequences in character classes — at Version 4
Reported by: | Kimball Leavitt | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | 3.0 |
Severity: | Normal | Keywords: | validators, regex |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
There are at least three places in the regex in django/core/validators.py that have unnecessary escape sequences inside of character classes:
Change History (4)
comment:1 by , 5 years ago
Has patch: | unset |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 5 years ago
Has patch: | set |
---|
comment:3 by , 5 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Yep, this looks fine. Thank you.
comment:4 by , 5 years ago
Description: | modified (diff) |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Thanks for the review. I submitted a PR for this yesterday - https://github.com/django/django/pull/12498/files.
You're right, the third one was wrong. I made the fix first, then submitted the ticket, so I hastily grabbed the wrong line. I changed it so it's correct (https://github.com/django/django/blob/master/django/core/validators.py#L166).
Ah, you beat me to it lol.
The third example here (L162) is:
I can't see an escape inside a character class there.
Might just be early?
I applied a quick adjustment, which seemed to run OK. (Existing tests passed.)
Happy to look more closely in a PR.
Thanks for the report.