• J Robert Ray's avatar
    Fully initialize allocated memory. · f1b2b636
    J Robert Ray authored
    __pyx_CyFunctionObject.defaults must be fully zeroed or a segfault or
    memory corruption may occur if the object is visited by the garbage
    collector before defaults is later populated. Uninitialized memory is
    cast to PyObject* with undefined results:
    
      static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
      {
          ...
          if (m->defaults) {
              PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
              int i;
              for (i = 0; i < m->defaults_pyobjects; i++)
                  Py_VISIT(pydefaults[i]);
                           ^^^^^^^^^^^^^
    f1b2b636
CythonFunction.c 33.2 KB