MutaFix run: sortedcontainers-011
ranker nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B · patcher nvidia/nemotron-3-super-120b-a12b · via Nebius Token Factory
- if not (not isinstance(other, Mapping)): (injected bug)+ if not isinstance(other, Mapping): (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_sorteddict.py::test_ror_not_implementedtests/test_coverage_sorteddict.py::test_ror_not_implemented
E AttributeError: 'CustomOr' object has no attribute 'items'
tests/test_coverage_sorteddict.py::test_ror_not_implemented 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/sorteddict.py::SortedDict.__ror__src/sortedcontainers/sortedlist.py::SortedList.__init__src/sortedcontainers/sortedlist.py::SortedList.updatesrc/sortedcontainers/sorteddict.py::SortedDict.__init__src/sortedcontainers/sortedlist.py::SortedList.__new__src/sortedcontainers/sorteddict.py::SortedDict.updatesrc/sortedcontainers/sorteddict.py::SortedDict.__reduce__src/sortedcontainers/sorteddict.py::SortedDict.__delitem__src/sortedcontainers/sorteddict.py::SortedDict.__repr__src/sortedcontainers/sorteddict.py::SortedDict.__or__src/sortedcontainers/sorteddict.py::SortedDict.__iter__src/sortedcontainers/sorteddict.py::SortedDict.__reversed__src/sortedcontainers/sorteddict.py::SortedDict.__setitem__src/sortedcontainers/sorteddict.py::SortedDict.__ior__src/sortedcontainers/sortedlist.py::SortedList.__setitem__src/sortedcontainers/sorteddict.py::SortedDict.popsrc/sortedcontainers/sorteddict.py::SortedDict.itemssrc/sortedcontainers/sorteddict.py::SortedDict.clearsrc/sortedcontainers/sorteddict.py::SortedDict.copysrc/sortedcontainers/sortedset.py::SortedSet.remove
src/sortedcontainers/sorteddict.py::SortedDict.__ror__src/sortedcontainers/sortedlist.py::SortedList.__init__src/sortedcontainers/sortedlist.py::SortedList.updatesrc/sortedcontainers/sorteddict.py::SortedDict.__init__src/sortedcontainers/sortedlist.py::SortedList.__new__
read src/sortedcontainers/sorteddict.py::SortedDict.__ror__
The failing test expects a TypeError when using the | operator with CustomOr and SortedDict, but the current __ror__ implementation tries to call .items() on other, which fails if other is not a Mapping. The error message shows 'CustomOr object has no attribute items', indicating that the code is trying to access .items() on other without checking if it has that attribute. The condition checks for Mapping but uses 'not isinstance(other, Mapping)' which would be true for CustomOr, causing the function to proceed and attempt to call .items() on it.
The condition `if not (not isinstance(other, Mapping))` is equivalent to `if isinstance(other, Mapping)`, which incorrectly returns NotImplemented when other is a Mapping. This causes the method to proceed and attempt to call `.items()` on non-Mapping objects like CustomOr, leading to the AttributeError. The correct logic should return NotImplemented when other is NOT a Mapping, so the condition should be simplified to `if not isinstance(other, Mapping)`.
--- a/src/sortedcontainers/sorteddict.py+++ b/src/sortedcontainers/sorteddict.py@@ -284,5 +284,5 @@ def __ror__(self, other):- if not (not isinstance(other, Mapping)):+ if not isinstance(other, Mapping): return NotImplemented items = chain(other.items(), self.items())
tests: all tests pass
Final patch
--- a/src/sortedcontainers/sorteddict.py+++ b/src/sortedcontainers/sorteddict.py@@ -284,5 +284,5 @@ def __ror__(self, other):- if not (not isinstance(other, Mapping)):+ if not isinstance(other, Mapping): return NotImplemented items = chain(other.items(), self.items())