Index: genshi/template/tests/directives.py
===================================================================
--- genshi/template/tests/directives.py	(revision 572)
+++ genshi/template/tests/directives.py	(working copy)
@@ -384,7 +384,26 @@
                       Hi, you!
         """, str(tmpl.generate()))
 
+    def test_function_with_star_args(self):
+        """
+        Verify that a named template function using "star arguments" works as
+        expected.
+        """
+        tmpl = MarkupTemplate("""<doc xmlns:py="http://genshi.edgewall.org/">
+          <div py:def="f(*args, **kwargs)">
+            ${repr(args)}
+            ${repr(kwargs)}
+          </div>
+          ${f(1, 2, a=3, b=4)}
+        </doc>""")
+        self.assertEqual("""<doc>
+          <div>
+            [1, 2]
+            {'a': 3, 'b': 4}
+          </div>
+        </doc>""", str(tmpl.generate()))
 
+
 class ForDirectiveTestCase(unittest.TestCase):
     """Tests for the `py:for` template directive."""
 
Index: genshi/template/directives.py
===================================================================
--- genshi/template/directives.py	(revision 572)
+++ genshi/template/directives.py	(working copy)
@@ -245,7 +245,7 @@
       </p>
     </div>
     """
-    __slots__ = ['name', 'args', 'defaults']
+    __slots__ = ['name', 'args', 'star_args', 'dstar_args', 'defaults']
 
     ATTRIBUTE = 'function'
 
@@ -253,6 +253,8 @@
         Directive.__init__(self, None, template, namespaces, lineno, offset)
         ast = _parse(args).node
         self.args = []
+        self.star_args = None
+        self.dstar_args = None
         self.defaults = {}
         if isinstance(ast, compiler.ast.CallFunc):
             self.name = ast.node.name
@@ -265,6 +267,10 @@
                                                          lookup=template.lookup)
                 else:
                     self.args.append(arg.name)
+            if ast.star_args:
+                self.star_args = ast.star_args.name
+            if ast.dstar_args:
+                self.dstar_args = ast.dstar_args.name
         else:
             self.name = ast.name
 
@@ -283,6 +289,10 @@
                     else:
                         val = self.defaults.get(name).evaluate(ctxt)
                     scope[name] = val
+            if not self.star_args is None:
+                scope[self.star_args] = args
+            if not self.dstar_args is None:
+                scope[self.dstar_args] = kwargs
             ctxt.push(scope)
             for event in _apply_directives(stream, ctxt, directives):
                 yield event
