Consider the following code inside a one-line pyx file: cdef object someint = 7
Then Cython generates the following inside the module init function: /*--- Global init code ---*/ __pyx_v_9refleaks2_someint = Py_None; Py_INCREF(Py_None); /* "/u/dalcinl/Devel/Cython/sandbox/refleaks2.pyx":1 * cdef object someint = 7 # <<<<<<<<<<<<<< * */ Py_INCREF(__pyx_int_7); __pyx_v_9refleaks2_someint = __pyx_int_7; Clearly, Py_None references are being leaked. All this is because of bad interaction between this two methods: * ModuleNode.generate_global_init_code(...) (in ModuleNode.py) * FinalOptimizePhase.visit_SingleAssignmentNode(...) (in Optimize.py) -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
