-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
std.sort.pdq use correct recursion depth #24403
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
Conversation
Take a look at the start of the stack trace:
We're failing an Lines 1261 to 1264 in 1c73b25
Yep -- so, we're calling Since there are no steps involved in sorting zero elements, you should be able to solve this simply by short-circuiting that case at the very top of the function like this: if (a == b) return; |
I think it's better to assert |
I don't see any reason sorting functions should require a non-empty input. Sorting a zero-length slice is well-defined with obvious behavior, and it requires either no special handling or in the worst case one trivial check. |
I suggest to check what the go implementation does |
Sorry, something as core as sorting needs a more disciplined approach. You can't just haphazardly push stuff to the CI and see what changes. Please investigate thoroughly before presenting your results by making a PR. |
Fixes #24399