fix refcount bug in initial __path__ setting
authorStefan Behnel <stefan_ml@behnel.de>
Tue, 7 Aug 2012 13:23:15 +0000 (15:23 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Tue, 7 Aug 2012 13:23:15 +0000 (15:23 +0200)
Cython/Compiler/ModuleNode.py

index b199565..c39f536 100644 (file)
@@ -1845,10 +1845,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                         code.globalstate.get_py_string_const(
                             EncodedString(decode_filename(os.path.dirname(source_path)))).cname,
                         code.error_goto_if_null(temp, self.pos)))
+                    code.put_gotref(temp)
                     code.putln('if (__Pyx_SetAttrString(%s, "__path__", %s) < 0) %s;' % (
                         env.module_cname,
                         temp,
                         code.error_goto(self.pos)))
+                    code.put_decref_clear(temp, py_object_type)
                     code.funcstate.release_temp(temp)
 
         if Options.cache_builtins: