projects
/
cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e35931d
)
Keep counted reference to module
author
Gregory Ewing
<greg.ewing@canterbury.ac.nz>
Mon, 26 Nov 2007 09:49:11 +0000
(22:49 +1300)
committer
Gregory Ewing
<greg.ewing@canterbury.ac.nz>
Mon, 26 Nov 2007 09:49:11 +0000
(22:49 +1300)
+
+ - 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]
Cython/Compiler/ModuleNode.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/ModuleNode.py
b/Cython/Compiler/ModuleNode.py
index 99065b6132484dc54bc8c831836b648177a50770..c86204fb5902f5226eb49e1acdeae5eacf003d4e 100644
(file)
--- a/
Cython/Compiler/ModuleNode.py
+++ b/
Cython/Compiler/ModuleNode.py
@@
-1543,6
+1543,9
@@
class ModuleNode(Nodes.Node, Nodes.BlockNode):
"if (!%s) %s;" % (
env.module_cname,
code.error_goto(self.pos)));
+ code.putln(
+ "Py_INCREF(%s);" %
+ env.module_cname)
code.putln(
'%s = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);' %
Naming.builtins_cname)