[pypy-dev] cpyext: Detecting pypy and other issues

Roger Binns rogerb at rogerbinns.com
Sun May 1 12:08:12 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The website is totally silent on how to debug C extension issues.

I'm encountering an issue where calling PyObject_GetAttrString results in pypy getting SIGSEGV.  The first parameter is the module (return of Py_InitModule3) stored in a static variable.  If I add an extra Py_INCREF to init then that goes away.  It is behaving as though modules are created with a ref count of zero.  Do I have to add an incref for everything that has a static pointer to it?

My next problem is a list allocated with PyList_New(0).  I later call PyList_GET_SIZE on it and get a SIGSEGV.  I put an assertion before that of PyList_Check but that crashes too.  Unfortunately I can't really do much with the pypy/gdb output:

E<InvalidPointerException object at 0x134fe28>
RPython traceback:
  File "implement_1.c", line 52621, in PyList_Check
  File "implement_5.c", line 14533, in CpyTypedescr_realize

Program received signal SIGSEGV, Segmentation fault.
0x000000000041118e in ?? ()
(gdb) bt
#0  0x000000000041118e in ?? ()
#1  0x00000000004ab890 in ?? ()
#2  0x0000000000f47bfb in ?? ()
#3  0x000000000043f31f in PyList_Check ()
#4  0x00007ffff5410795 in Connection_close_internal (self=0x7ffff7f91030, force=1) at src/connection.c:166
#5  0x00007ffff5410b6d in Connection_close (self=0x7ffff7f91030, args=0x7ffff7f8ee60) at src/connection.c:274
#6  0x0000000000f47bfb in ?? ()
#7  0x0000000000729236 in ?? ()
...
#154 0x00007ffff5cfbeff in __libc_start_main (main=0x4118b0, argc=2, ubp_av=0x7fffffffe108, init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=0x7fffffffe0f8) at libc-start.c:226
...

Roger

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk29MQcACgkQmOOfHg372QRBUgCfVaXt6c8S7CKkWlmSyzOUknIV
FVMAniyQCLw7DWaElMF0AYiabbXqXsyV
=1Ecf
-----END PGP SIGNATURE-----



More information about the Pypy-dev mailing list