[Pyrex] Bug report on return inside a loop

Jiba jibalamy at free.fr
Sat May 6 20:38:50 CEST 2006


Hi,

I think there is a bug in Pyrex version 0.9.4.1. When compiling the following Pyrex code :


mylist = [[1], [2]]

def f():
  cdef int i
  for i from 0 <= i < 3:
    if mylist[i][0] is None:
      del mylist[i]
      break


Pyrex generates following C code (extract; near line 86) :


      Py_DECREF(__pyx_1); __pyx_1 = 0;

      /* "/home/jiba/src/./test_pyx.pyx":9 */
      Py_DECREF(__pyx_1); __pyx_1 = 0;


Which thus calls Py_DECREF(0) and yields a segfault.

However, replacing the "return" by "break" in the Pyrex code doesn't give the bug.

Jiba



More information about the Pyrex mailing list