MutaFix run: sortedcontainers-003
ranker nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B · patcher nvidia/nemotron-3-super-120b-a12b · via Nebius Token Factory
- while not (True): (injected bug)+ while True: (original)retriever rank 1 of 20 · ranker position 1 · patched the right function yes · exact restore yes
Trace
failing tests and errors
tests/test_coverage_sortedkeylist_modulo.py::test_remove tests/test_coverage_sortedkeylist_modulo.py::test_remove_valueerror2 tests/test_coverage_sortedkeylist_modulo.py::test_remove_valueerror3 tests/test_coverage_sortedkeylist_modulo.py::test_remove_valueerror5 tests/test_coverage_sortedkeylist_modulo.py::test_delete tests/test_coverage_sortedkeylist_negate.py::test_remove tests/test_coverage_sortedkeylist_negate.py::test_remove_valueerror2 tests/test_coverage_sortedkeylist_negate.py::test_remove_valueerror3 tests/test_coverage_sortedkeylist_negate.py::test_delete tests/test_stress_sortedkeylist.py::test_stresstests/test_coverage_sortedkeylist_modulo.py::test_remove
E assert False E + where False = all(<generator object test_remove.<locals>.<genexpr> at 0x00000272D88F3E00>)tests/test_coverage_sortedkeylist_modulo.py::test_remove_valueerror2
E Failed: DID NOT RAISE ValueError
tests/test_coverage_sortedkeylist_modulo.py::test_remove in the static call graph. Kept 20 candidates, ranked by spectrum score (Ochiai), call graph and BM25 break ties.candidates in retriever order
src/sortedcontainers/sortedlist.py::SortedKeyList.removesrc/sortedcontainers/sortedlist.py::SortedKeyList.discardsrc/sortedcontainers/sortedlist.py::SortedKeyList.updatesrc/sortedcontainers/sortedlist.py::SortedKeyList.__new__src/sortedcontainers/sortedlist.py::SortedKeyList.__init__src/sortedcontainers/sortedlist.py::SortedList.__len__src/sortedcontainers/sortedlist.py::SortedKeyList.__repr__src/sortedcontainers/sortedlist.py::identitysrc/sortedcontainers/sortedlist.py::SortedList._resetsrc/sortedcontainers/sortedlist.py::SortedKeyList.clearsrc/sortedcontainers/sortedlist.py::SortedKeyList._checksrc/sortedcontainers/sortedlist.py::SortedList.__iter__src/sortedcontainers/sortedlist.py::SortedList.__getitem__src/sortedcontainers/sorteddict.py::SortedDict._checksrc/sortedcontainers/sortedset.py::SortedSet._checksrc/sortedcontainers/sortedset.py::SortedSet.discardsrc/sortedcontainers/sortedlist.py::SortedList.discardsrc/sortedcontainers/sortedlist.py::SortedList._checksrc/sortedcontainers/sortedlist.py::SortedKeyList.__add__src/sortedcontainers/sortedlist.py::SortedKeyList.__contains__
src/sortedcontainers/sortedlist.py::SortedKeyList.removesrc/sortedcontainers/sortedlist.py::SortedKeyList.discardsrc/sortedcontainers/sortedlist.py::SortedKeyList.updatesrc/sortedcontainers/sortedlist.py::SortedKeyList.__new__src/sortedcontainers/sortedlist.py::SortedKeyList.__init__
read src/sortedcontainers/sortedlist.py::SortedKeyList.remove
The failing tests involve `remove` and expect a ValueError when removing a non-existent value, but the current implementation uses an infinite loop (`while not (True)`) which never executes the body and thus never raises the error. This suggests a logic error in the `remove` method.
The `while not (True)` condition is always false, so the loop body never executes. This causes the method to silently fall through without raising a ValueError when the value is not found. Changing it to `while True` allows the loop to execute and properly check for the value, raising ValueError when appropriate.
--- a/src/sortedcontainers/sortedlist.py+++ b/src/sortedcontainers/sortedlist.py@@ -1933,5 +1933,5 @@ len_sublist = len(_keys[pos]) - while not (True):+ while True: if _keys[pos][idx] != key: raise ValueError(f'{value!r} not in list')
tests: all tests pass
Final patch
--- a/src/sortedcontainers/sortedlist.py+++ b/src/sortedcontainers/sortedlist.py@@ -1933,5 +1933,5 @@ len_sublist = len(_keys[pos]) - while not (True):+ while True: if _keys[pos][idx] != key: raise ValueError(f'{value!r} not in list')