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)
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):
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.analyse_default_values(env)
+ self.local_scope.directives = env.directives
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 = []
_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