From c4043e826ebae53b5716b8cee6ce4f609a99b8a3 Mon Sep 17 00:00:00 2001 From: "tom@tom" Date: Tue, 18 Sep 2007 19:43:44 +0200 Subject: [PATCH] partial code for execution in classes --- Cython/Compiler/Nodes.py | 3 ++- Cython/Compiler/Parsing.py | 2 -- Cython/Compiler/Symtab.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 0aa2aa74..ac52ce68 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1370,8 +1370,9 @@ class CClassDefNode(StatNode): env.allocate_vtable_names(self.entry) def analyse_expressions(self, env): + scope = self.entry.type.scope if self.body: - self.body.analyse_expressions(env) + self.body.analyse_expressions(scope) def generate_function_definitions(self, env, code): if self.body: diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index 9ed27639..e495b37b 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -1227,8 +1227,6 @@ def p_statement(s, level, cdef_flag = 0, visibility = 'private'): if level in ('c_class', 'c_class_pxd'): if s.sy == 'pass': return p_pass_statement(s, with_newline = 1) - else: - s.error("Executable statement not allowed here") if s.sy == 'if': return p_if_statement(s) elif s.sy == 'while': diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 7daeb4e4..bd828ab4 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -1088,7 +1088,7 @@ class CClassScope(ClassScope): if name in ('__eq__', '__ne__', '__lt__', '__gt__', '__le__', '__ge__'): error(pos, "Special method %s must be implemented via __richcmp__" % name) - entry = self.declare(name, name, py_object_type, pos) + entry = self.declare_var(name, py_object_type, pos) special_sig = get_special_method_signature(name) if special_sig: # Special methods get put in the method table with a particular -- 2.26.2