Commit 4572c0b0 authored by Gregory Ewing's avatar Gregory Ewing

Keep counted reference to module


+
+    - A counted reference was not kept to the module, so if the entry
+        in sys.modules was replaced, the module was freed prematurely.
+        [Franck Pommerau]
parent e35931d2
...@@ -1543,6 +1543,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1543,6 +1543,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"if (!%s) %s;" % ( "if (!%s) %s;" % (
env.module_cname, env.module_cname,
code.error_goto(self.pos))); code.error_goto(self.pos)));
code.putln(
"Py_INCREF(%s);" %
env.module_cname)
code.putln( code.putln(
'%s = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);' % '%s = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);' %
Naming.builtins_cname) Naming.builtins_cname)
......
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