BUG: Subtle bug in merge_sort
with length 1 lists (note complication)
#14
Labels
bug
Something isn't working
merge_sort
with length 1 lists (note complication)
#14
When sorting a length 1 list, the returned list is identical to the input list. This leads to a subtle inconsistency and a copy should be returned.
As a toy example, if the code for example, replaces the largest element later:
then the original data is normally not be modified. But if the input has length 1, it will be.
Minimal reproducer
Working on the issue
When fixing this issue, make sure to add a new test function (after
test_mergesort_empty
!).NOTE: If you work on this issue, changes are likely to conflict with the issue gh-8. This means that whichever PR is merged second, will need to deal with the "merge conflict".
Because of that and we may wait with merging this until the other PR is merged.
The text was updated successfully, but these errors were encountered: