Repository: paver/paver

Issue:
When a empty args list is given to call_task, the args of the previous task are used.
I have a task that calls another task. The first one give 0 to n arguments to the the second one. The first needs a third task that is calling a fourth one with some arguments. When the first one gives at least 1 argument, the behavior is correct. But when the first one uses an empty list of arguments, the arguments of the call of the third to the fourth are reused.

```
from paver.easy import *

@task
@needs('specific_dep')
@consume_args
def my_task(args):
    call_task('the_other_task', args=args)

@task
@consume_args
def the_other_task(args):
    info('Doing the thing with the args: %s', args)

@task
def specific_dep():
    call_task('generic_dep', args=['specific'])

@task
@consume_args
def generic_dep(args):
    name, = args
    info('Loading the dependency %s', name)
```

```
% ./venv/bin/paver my_task args
---> pavement.my_task
---> pavement.specific_dep
---> pavement.generic_dep
Loading the dependency specific
---> pavement.the_other_task
Doing the thing with the args: ['args'] 
% ./venv/bin/paver my_task
---> pavement.my_task
---> pavement.specific_dep
---> pavement.generic_dep
Loading the dependency specific
---> pavement.the_other_task
Doing the thing with the args: ['specific'] ### Should be Doing the thing with the args: []
```

Discussion:

Patch:
diff --git a/paver/tasks.py b/paver/tasks.py
index 2eb1c4a..3498321 100644
--- a/paver/tasks.py
+++ b/paver/tasks.py
@@ -147,11 +147,11 @@ class Environment(object):
             for option in options:
                 task._set_value_to_task(task_name, option, None, options[option])
 
-        if args and task.consume_args > 0:
+        if args is not None and task.consume_args > 0:
             args = _consume_nargs(task, args)
         elif args and (task.consume_args == 0):
             raise BuildFailure("Task %s is not decorated with @consume_(n)args,"
-                                "but has been called with them")
+                                "but has been called with them" % task)
         task()
 
     def _run_task(self, task_name, needs, func):


Test patch:
diff --git a/paver/tests/test_tasks.py b/paver/tests/test_tasks.py
index b8a419c..62419d7 100644
--- a/paver/tests/test_tasks.py
+++ b/paver/tests/test_tasks.py
@@ -847,6 +847,25 @@ def test_calling_task_with_arguments():
 
     tasks._process_commands(['t1'])
 
+def test_calling_task_with_empty_arguments():
+    @tasks.task
+    def t1():
+        env.call_task('t3', args=['argument1'])
+        env.call_task('t2', args=[])
+
+    @tasks.task
+    @tasks.consume_args
+    def t2(args):
+        assert args == []
+
+    @tasks.task
+    @tasks.consume_args
+    def t3(args):
+        assert args == ['argument1']
+
+    env = _set_environment(t1=t1, t2=t2, t3=t3)
+    tasks._process_commands(['t1'])
+
 def test_calling_nonconsuming_task_with_arguments():
     @tasks.task
     def t2():