From c9362d39c1be54f8290006db00fe71d824ff091c Mon Sep 17 00:00:00 2001 From: Ryan Gonzalez Date: Thu, 13 Nov 2014 17:49:17 -0600 Subject: [PATCH] Fix #684 --- hy/compiler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hy/compiler.py b/hy/compiler.py index 4c7af9c..7c7925e 100644 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -1268,7 +1268,8 @@ class HyASTCompiler(object): def compile_decorate_expression(self, expr): expr.pop(0) # with-decorator fn = self.compile(expr.pop(-1)) - if not fn.stmts or not isinstance(fn.stmts[-1], ast.FunctionDef): + if not fn.stmts or not (isinstance(fn.stmts[-1], ast.FunctionDef) or + isinstance(fn.stmts[-1], ast.ClassDef)): raise HyTypeError(expr, "Decorated a non-function") decorators, ret = self._compile_collect(expr) fn.stmts[-1].decorator_list = decorators