module_traverse segfault

Roland Plüss roland at rptd.ch
Mon Jun 16 16:16:16 EDT 2014


>> Program received signal SIGSEGV, Segmentation fault.
>> 0x00007fffffffc958 in ?? ()
>> (gdb) bt
>> #0  0x00007fffffffc958 in ?? ()
>> #1  0x00007fffdd2f9ed0 in module_traverse () from
>> /usr/lib64/libpython3.3.so.1.0
>> #2  0x00007fffdd396cc7 in collect_with_callback () from
>> /usr/lib64/libpython3.3.so.1.0
>> #3  0x00007fffdd397738 in PyGC_Collect () from
>> /usr/lib64/libpython3.3.so.1.0
>> #4  0x00007fffdd3808ca in Py_Finalize () from
>> /usr/lib64/libpython3.3.so.1.0
>
> Can you run (some of) the same code in a normal interpreter?  If so,
> does it raise an uncaught exception?
Can't, it's fully embedded inside the application and fully loads
C-classes from C-land memory without any files or libraries.
> Was the program supposed to be shutting down when this occurred? Or
> did this happen during 'normal' execution?
Shutting down. It happens though also if I trigger an error for example
using
    if( ! PyArg_ParseTuple( args, "iiii", &x1, &y1, &x2, &y2 ) ){
        return NULL;
    }
and proving for example floats instead of integer.

So it happens as soon as the GC is involved. Could it be a tp_* function
that is marked optional is actually not optional at all? According to
the documentation I need only this:
@@@@@@
typeObject = new sObjectType;

memset( typeObject, 0, sizeof( sObjectType ) );
typeObject->tp_name = "Dragengine.Gui.Graphics.Graphics";
typeObject->tp_basicsize = sizeof( sObjectData );
typeObject->tp_flags = Py_TPFLAGS_DEFAULT;
typeObject->tp_doc = "Graphics Object";
typeObject->tp_methods = vMethodsInstance;
typeObject->tp_new = ( newfunc )spModuleGraphics::cfNew;
typeObject->tp_init = ( initproc )spModuleGraphics::cfInit;
typeObject->tp_dealloc = ( destructor )spModuleGraphics::cfDealoc;
typeObject->ownerClass = this;

PyType_Ready( typeObject );

Py_INCREF( typeObject );
PyModule_AddObject( pPyModule, "Graphics", ( PyObject* )typeObject );
@@@@@@

where sObject is:
@@@@@@
struct sObjectType : public PyTypeObject{
    spModuleGraphics *ownerClass;
};
@@@@@@

but maybe the documentation is missing something there?

>
> In any case, switch to 3.4.1 or later for improved gc and finalization.
>
Not in GenToo yet as far as I know.

-- 
Yours sincerely
Plüss Roland

Leader and Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
- As well as various Blender export scripts und game tools

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20140616/962bdd35/attachment.sig>


More information about the Python-list mailing list