Hi,

Dag Sverre Seljebotn wrote:
> Note that the current -devel could be released for what I know, except 
> for the things that are already noted, there's no rush as the systems 
> work together.

There's one remaining problem with the for loop. It seems that in certain
cases (at least in lxml, haven't got a trivial test case yet) it crashes
due to multiple allocation of the same temp. I pasted the generated code
section below, note how __pyx_t_4 is used. There's also an inner loop
involved, which I left out here. Funny enough, it also uses __pyx_t_4 to
store the iterator.

http://trac.cython.org/cython_trac/ticket/148

Stefan


 *         for constants in constant_tuple:             # <<<<<<<<<<<<<<
 *             #print len(constants) + 1
 *             for name, value in find_constants(constants):
 */
    /* __pyx_t_7 allocated */
    /* __pyx_t_4 allocated */
    if (PyList_CheckExact(__pyx_v_constant_tuple) || \
                        PyTuple_CheckExact(__pyx_v_constant_tuple)) {
      __pyx_t_7 = 0; __pyx_t_4 = __pyx_v_constant_tuple; \
                                            Py_INCREF(__pyx_t_4);
    } else {
      __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_constant_tuple);
                                                        [error goto]
    }
    for (;;) {
      /* __pyx_t_4 allocated */
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_7);
Py_INCREF(__pyx_t_4); __pyx_t_7++;
      } else if (likely(PyTuple_CheckExact(__pyx_t_4))) {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7);
Py_INCREF(__pyx_t_4); __pyx_t_7++;
      } else {
        __pyx_t_4 = PyIter_Next(__pyx_t_4);
        if (!__pyx_t_4) {
          if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[7];
__pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          break;
        }
      }
      Py_DECREF(__pyx_v_constants);
      __pyx_v_constants = __pyx_t_4;
      __pyx_t_4 = 0;
      /* __pyx_t_4 released */
[...]
    }
    /* __pyx_t_7 released */
    Py_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    /* __pyx_t_4 released */
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to