Commit 6fbb5fd9 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.29.x'

parents fb2ae360 0e8bc15d
......@@ -346,6 +346,8 @@ Bugs fixed
* Exception position reporting could run into race conditions on threaded code.
It now uses function-local variables again.
* Error handling early in the module init code could lead to a crash.
0.29.17 (2020-04-26)
====================
......
......@@ -2572,7 +2572,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln('#endif')
def generate_module_init_func(self, imported_modules, env, code):
subfunction = self.mod_init_subfunction(self.scope, code)
subfunction = self.mod_init_subfunction(self.pos, self.scope, code)
self.generate_pymoduledef_struct(env, code)
......@@ -2720,10 +2720,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if Options.cache_builtins:
code.putln("/*--- Builtin init code ---*/")
code.put_error_if_neg(None, "__Pyx_InitCachedBuiltins()")
code.put_error_if_neg(self.pos, "__Pyx_InitCachedBuiltins()")
code.putln("/*--- Constants init code ---*/")
code.put_error_if_neg(None, "__Pyx_InitCachedConstants()")
code.put_error_if_neg(self.pos, "__Pyx_InitCachedConstants()")
code.putln("/*--- Global type/function init code ---*/")
......@@ -2819,7 +2819,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.exit_cfunc_scope()
def mod_init_subfunction(self, scope, orig_code):
def mod_init_subfunction(self, pos, scope, orig_code):
"""
Return a context manager that allows deviating the module init code generation
into a separate function and instead inserts a call to it.
......@@ -2875,9 +2875,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("")
if needs_error_handling:
self.call_code.use_label(orig_code.error_label)
self.call_code.putln("if (unlikely(%s() != 0)) goto %s;" % (
self.cfunc_name, orig_code.error_label))
self.call_code.putln(
self.call_code.error_goto_if_neg("%s()" % self.cfunc_name, pos))
else:
self.call_code.putln("(void)%s();" % self.cfunc_name)
self.call_code = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment