From: Dag Sverre Seljebotn Date: Sun, 29 Mar 2009 15:48:29 +0000 (+0200) Subject: merge X-Git-Tag: 0.12.alpha0~346^2~1 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=1b78c83cbf3993b3aab8b010b7226362d2187517;p=cython.git merge --- 1b78c83cbf3993b3aab8b010b7226362d2187517 diff --cc Cython/Compiler/ModuleNode.py index 8309a69c,21c62a8e..78297907 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@@ -253,11 -253,16 +253,12 @@@ class ModuleNode(Nodes.Node, Nodes.Bloc code.globalstate.use_utility_code(refcount_utility_code) + code.putln('const char *%s = "%s";' % (Naming.modulename_cname, self.full_module_name)) code.putln("") code.putln("/* Implementation of %s */" % env.qualified_name) - self.generate_const_definitions(env, code) - self.generate_interned_num_decls(env, code) - self.generate_interned_string_decls(env, code) - self.generate_py_string_decls(env, code) code.globalstate.insert_global_var_declarations_into(code) - + self.generate_cached_builtins_decls(env, code) self.body.generate_function_definitions(env, code) code.mark_pos(None) diff --cc Cython/Compiler/Nodes.py index be2f7e19,a5154ead..347fdbb4 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@@ -538,9 -573,9 +539,10 @@@ class CFuncDeclaratorNode(CDeclaratorNo else: if self.exception_value: self.exception_value.analyse_const_expression(env) + exc_val = self.exception_value.get_constant_result_code() if self.exception_check == '+': exc_val_type = self.exception_value.type + env.add_include_file('stdexcept') if not exc_val_type.is_error and \ not exc_val_type.is_pyobject and \ not (exc_val_type.is_cfunction and not exc_val_type.return_type.is_pyobject and len(exc_val_type.args)==0): @@@ -1349,16 -1392,16 +1351,17 @@@ class CFuncDefNode(FuncDefNode) if type.return_type.is_pyobject: error(self.pos, "Function with Python return type cannot be declared nogil") - for entry in lenv.var_entries + lenv.temp_entries: + for entry in env.var_entries + env.temp_entries: if entry.type.is_pyobject: error(self.pos, "Function declared nogil has Python locals or temporaries") - return with_gil def analyse_expressions(self, env): + self.local_scope.directives = env.directives - self.analyse_default_values(env) if self.py_func is not None: + # this will also analyse the default values self.py_func.analyse_expressions(env) + else: + self.analyse_default_values(env) def generate_function_header(self, code, with_pymethdef, with_opt_args = 1, with_dispatch = 1, cname = None): arg_decls = [] diff --cc tests/errors/nogil.pyx index 04feaa2d,10a9fe7e..e3a5b6d3 --- a/tests/errors/nogil.pyx +++ b/tests/errors/nogil.pyx @@@ -78,12 -78,12 +78,12 @@@ cdef void t(C c) nogil _ERRORS = u""" - 1: 5: Function with Python return type cannot be declared nogil - 6: 6: Assignment of Python object not allowed without gil - 4: 5: Function declared nogil has Python locals or temporaries + 1: 5: Function with Python return type cannot be declared nogil + 6: 6: Assignment of Python object not allowed without gil + 4: 5: Function declared nogil has Python locals or temporaries 11: 5: Function with Python return type cannot be declared nogil -15: 5: Calling gil-requiring function without gil -24: 9: Calling gil-requiring function without gil +15: 5: Calling gil-requiring function not allowed without gil +24: 9: Calling gil-requiring function not allowed without gil 26:12: Assignment of Python object not allowed without gil 28: 8: Constructing complex number not allowed without gil 29:12: Accessing Python global or builtin not allowed without gil