[pypy-issue] [issue1668] sporadic seg fault with cffi

Armin Rigo arigo at tunes.org
Tue Jan 7 09:46:02 CET 2014


Hi,

I can reproduce your segfault on CPython too, so the problem is not
PyPy.  The problem is a keepalive issue.  CPython crashes consistently
on a line like this:

    print gmpy_cffi.mpc(1.5, 2.3).real

I guess it's because the .real returns a reference inside the data
managed by the mpc object, but it is deallocated while the .real
object is still alive, which ends up in a crash.  With CPython, you
can find it reliably by compiling _cffi_backend with -DCFFI_MEM_DEBUG
before running the tests.  (I guess that it is a trick that should be
mentioned on the doc page...)


A bientôt,

Armin.


More information about the pypy-issue mailing list