zzzeek/mako — pull request #7 by eevee (2014-02-11 21:53:11+00:00)
Title: Support py3k kwonly args

They were being correctly _parsed_ already, but a template like this:

```
<%def name="asdf(*qwert, zxcv='hi')">${zxcv}
```

would generate code like this:

```
def render_asdf(context,*qwert):
__M_caller = context.caller_stack._push_frame()
try:
zxcv = context.get('zxcv', UNDEFINED)
...
```

which would then either `TypeError` when called with the required keyword argument, or (if there were also a `**kwargs`) have the argument overwritten by `UNDEFINED` right out of the gate.

Should work now. Added a few tests. Everything passes on Python 2.7, Python 3.3, and PyPy 2.2.1 (except for two tests that fail PyPy in Beaker somewhere, so not a Mako problem).

Inspired by... mitsuhiko, or python-future, or someone?, I added a `compat.py2k`, so code can be written as though Python 3 were the default and Python 2 were the special case.

I also made a best effort at the `_ast`-less code path; four tests fail, but all four of them are problems with how Pygments decided to color the syntax, so I _assume_ that's just an inherent issue with the `compiler` module. (Two of them are marked as requiring Python 2.5+, so will never run in practice anyway.)