diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index 064de234..a7edeb52 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -2317,6 +2317,7 @@ static Error* compile_function(Compiler* self, int decorators) { static Error* compile_class(Compiler* self, int decorators) { Error* err; + if(ctx()->level > 1) return SyntaxError(self, "class definition not allowed here"); consume(TK_ID); py_Name name = py_namev(Token__sv(prev())); bool has_base = false;