MutaFix run: sortedcontainers-001
ranker nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B · patcher nvidia/nemotron-3-super-120b-a12b · via Nebius Token Factory
- if not (not _maxes): (injected bug)+ if not _maxes: (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_sortedlist.py::test_contains tests/test_stress_sortedlist.py::test_stresstests/test_coverage_sortedlist.py::test_contains
E assert 0 in SortedList([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, ...980, 9981, 9982, 9983, 9984, 9985, 9986, 9987, 9988, 9989, 9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999])tests/test_stress_sortedlist.py::test_stress
E assert 0.3663326084320272 in SortedList([0.010499992612454268, 0.01136869279981445, 0.01177038701662747, 0.01177038701662747, 0.01271581094480112, ....9850577188087127, 0.9882832016928882, 0.9886336872382965, 0.9912626799153788, 0.9921660154449652, 0.9940917797710432])
tests/test_coverage_sortedlist.py::test_contains 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::SortedList.__contains__src/sortedcontainers/sortedlist.py::SortedList.__repr__src/sortedcontainers/sortedlist.py::SortedList.__imul__src/sortedcontainers/sortedlist.py::SortedList.__reversed__src/sortedcontainers/sortedlist.py::SortedList.bisect_leftsrc/sortedcontainers/sortedlist.py::SortedList.irangesrc/sortedcontainers/sortedlist.py::SortedList.countsrc/sortedcontainers/sortedlist.py::SortedList.islicesrc/sortedcontainers/sortedlist.py::SortedList.__delitem__src/sortedcontainers/sortedlist.py::SortedList.__mul__src/sortedcontainers/sortedlist.py::SortedList._islicesrc/sortedcontainers/sortedlist.py::SortedList.discardsrc/sortedcontainers/sortedlist.py::SortedList.__len__src/sortedcontainers/sortedlist.py::SortedList.bisect_rightsrc/sortedcontainers/sortedlist.py::SortedList.popsrc/sortedcontainers/sortedlist.py::SortedList.__iter__src/sortedcontainers/sortedlist.py::SortedList.removesrc/sortedcontainers/sortedlist.py::SortedList._deletesrc/sortedcontainers/sortedlist.py::SortedList._locsrc/sortedcontainers/sortedlist.py::SortedList.__getitem__
src/sortedcontainers/sortedlist.py::SortedList.__contains__src/sortedcontainers/sortedlist.py::SortedList.__repr__src/sortedcontainers/sortedlist.py::SortedList.__imul__src/sortedcontainers/sortedlist.py::SortedList.__reversed__src/sortedcontainers/sortedlist.py::SortedList.bisect_left
read src/sortedcontainers/sortedlist.py::SortedList.__contains__
The failing test checks membership (`in`) of values in a SortedList, and the only candidate that directly implements `__contains__` is ranked highest for failing tests. The logic in `__contains__` uses `_maxes` to determine early exit, but the condition `not _maxes` is inverted—it should check `not _maxes` to return False only when `_maxes` is empty, but the current code returns False when `_maxes` is non-empty, causing incorrect containment checks.
The condition `if not (not _maxes)` is equivalent to `if _maxes`, which incorrectly returns False when the list is non-empty. It should simply check `if not _maxes` to return False when the list is empty. This bug causes the containment check to fail for all non-empty lists, as seen in the test where values like 0 are incorrectly reported as not present.
--- a/src/sortedcontainers/sortedlist.py+++ b/src/sortedcontainers/sortedlist.py@@ -315,5 +315,5 @@ _maxes = self._maxes - if not (not _maxes):+ if not _maxes: return False
tests: all tests pass
Final patch
--- a/src/sortedcontainers/sortedlist.py+++ b/src/sortedcontainers/sortedlist.py@@ -315,5 +315,5 @@ _maxes = self._maxes - if not (not _maxes):+ if not _maxes: return False