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
Fixed #35252 -- Optimized _route_to_regex(). #17908
Conversation
Thanks for the review @ngnpope, I'll action it tonight. |
Alright, done tonight. @ngnpope would you mind accepting the ticket, since it seems you think the optimization is worthwhile and safe? |
co-authored-by: Nick Pope <nick@nickpope.me.uk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamchainz Thanks 👍
|
||
@functools.cache | ||
def get_converters(): | ||
return {**DEFAULT_CONVERTERS, **REGISTERED_CONVERTERS} | ||
|
||
|
||
def get_converter(raw_converter): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a release note about removing this undocumented function.
django/urls/resolvers.py
Outdated
break | ||
elif not set(match.group()).isdisjoint(string.whitespace): | ||
previous_end = 0 | ||
for match in _PATH_PARAMETER_COMPONENT_RE.finditer(route): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed match
to match_
to avoid using a keyword.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair. It's a soft keyword deliberately to not break use of regexes like this, as I heard recently on https://podcasts.apple.com/gb/podcast/core-py/id1712665877?i=1000647675451 😉
ticket-35252