MutaFix run: toolz-010
ranker nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B · patcher nvidia/nemotron-3-super-120b-a12b · via Nebius Token Factory
- func, args = func_and_args[1], func_and_args[1:] (injected bug)+ func, args = func_and_args[0], func_and_args[1:] (original)retriever rank 1 of 20 · ranker position 1 · patched the right function yes · exact restore yes
Trace
failing tests and errors
toolz/tests/test_functoolz.py::test_applytoolz/tests/test_functoolz.py::test_apply
E TypeError: 'int' object is not callable
toolz/tests/test_functoolz.py::test_apply in the static call graph. Kept 20 candidates, ranked by spectrum score (Ochiai), call graph and BM25 break ties.candidates in retriever order
toolz/functoolz.py::applytoolz/__init__.py::__getattr__toolz/utils.py::raisestoolz/functoolz.py::curry.functoolz/functoolz.py::curry.argstoolz/itertoolz.py::tailtoolz/dicttoolz.py::itemmaptoolz/functoolz.py::thread_lasttoolz/dicttoolz.py::keymaptoolz/itertoolz.py::iteratetoolz/functoolz.py::curry.__init__toolz/functoolz.py::thread_firsttoolz/dicttoolz.py::valmaptoolz/functoolz.py::dotoolz/itertoolz.py::difftoolz/functoolz.py::memoize.<locals>.memoftoolz/itertoolz.py::taketoolz/dicttoolz.py::get_intoolz/_signatures.py::signature_or_spectoolz/itertoolz.py::isiterable
toolz/functoolz.py::applytoolz/__init__.py::__getattr__toolz/utils.py::raisestoolz/functoolz.py::curry.functoolz/functoolz.py::curry.args
read toolz/functoolz.py::apply
The failing test involves the `apply` function, and the source of `apply` in toolz/functoolz.py shows a clear bug: on line 43 it assigns `func, args = func_and_args[1], func_and_args[1:]`, which incorrectly skips the first element of `func_and_args` when unpacking. This would cause `func` to be bound to the second element instead of the first, leading to a TypeError when trying to call it. This is the most likely source of the failure.
The bug is in line 43: it incorrectly uses `func_and_args[1]` to extract the function, skipping the first element. It should use `func_and_args[0]` to get the first argument as the function. This change aligns with the expected behavior of `apply` as shown in the doctest and the failing test.
--- a/toolz/functoolz.py+++ b/toolz/functoolz.py@@ -41,5 +41,5 @@ if not func_and_args: raise TypeError('func argument is required')- func, args = func_and_args[1], func_and_args[1:]+ func, args = func_and_args[0], func_and_args[1:] return func(*args, **kwargs)
tests: all tests pass
Final patch
--- a/toolz/functoolz.py+++ b/toolz/functoolz.py@@ -41,5 +41,5 @@ if not func_and_args: raise TypeError('func argument is required')- func, args = func_and_args[1], func_and_args[1:]+ func, args = func_and_args[0], func_and_args[1:] return func(*args, **kwargs)