diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2017-10-29 18:58:07 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2017-10-29 18:58:07 +0100 |
commit | 5e6ca03861d559e7542633b781babd39735d043e (patch) | |
tree | 2418348ab0d7e9fa87674f7c021b1a7e58ad690b | |
parent | 0a4f732fcf4b5128e5eff4e976778cb6256dbaf3 (diff) | |
parent | fbb18722a6546e9e76cc8253023fd2689b010178 (diff) | |
download | cython-5e6ca03861d559e7542633b781babd39735d043e.tar.gz |
Merge branch '0.27.x'
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 4 | ||||
-rw-r--r-- | Cython/Compiler/Nodes.py | 6 | ||||
-rw-r--r-- | Cython/Utility/CythonFunction.c | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 1b903ccea..25ecf66a2 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -359,7 +359,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code = globalstate['before_global_var'] code.putln('#define __Pyx_MODULE_NAME "%s"' % self.full_module_name) - code.putln("int %s%s = 0;" % (Naming.module_is_main, self.full_module_name.replace('.', '__'))) + module_is_main = "%s%s" % (Naming.module_is_main, self.full_module_name.replace('.', '__')) + code.putln("extern int %s;" % module_is_main) + code.putln("int %s = 0;" % module_is_main) code.putln("") code.putln("/* Implementation of '%s' */" % env.qualified_name) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 73bbd57d5..fcba3672a 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -7156,6 +7156,7 @@ class TryFinallyStatNode(StatNode): code.putln('}') if preserve_error: + code.put_label(new_error_label) code.putln('/*exception exit:*/{') if not self.in_generator: code.putln("__Pyx_PyThreadState_declare") @@ -7173,7 +7174,6 @@ class TryFinallyStatNode(StatNode): exc_vars = tuple([ code.funcstate.allocate_temp(py_object_type, manage_ref=False) for _ in range(6)]) - code.put_label(new_error_label) self.put_error_catcher( code, temps_to_clean_up, exc_vars, exc_lineno_cnames, exc_filename_cname) finally_old_labels = code.all_new_labels() @@ -7266,11 +7266,11 @@ class TryFinallyStatNode(StatNode): code.globalstate.use_utility_code(get_exception_utility_code) code.globalstate.use_utility_code(swap_exception_utility_code) - code.putln(' '.join(["%s = 0;"]*len(exc_vars)) % exc_vars) if self.is_try_finally_in_nogil: code.put_ensure_gil(declare_gilstate=False) code.putln("__Pyx_PyThreadState_assign") + code.putln(' '.join(["%s = 0;" % var for var in exc_vars])) for temp_name, type in temps_to_clean_up: code.put_xdecref_clear(temp_name, type) @@ -7315,7 +7315,7 @@ class TryFinallyStatNode(StatNode): if self.is_try_finally_in_nogil: code.put_release_ensured_gil() - code.putln(' '.join(["%s = 0;"]*len(exc_vars)) % exc_vars) + code.putln(' '.join(["%s = 0;" % var for var in exc_vars])) if exc_lineno_cnames: code.putln("%s = %s; %s = %s; %s = %s;" % ( Naming.lineno_cname, exc_lineno_cnames[0], diff --git a/Cython/Utility/CythonFunction.c b/Cython/Utility/CythonFunction.c index 0a8a6812a..ba969c232 100644 --- a/Cython/Utility/CythonFunction.c +++ b/Cython/Utility/CythonFunction.c @@ -414,7 +414,7 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, {0, 0, 0, 0, 0} }; |