[ZODB-Dev] Help! weird C-code behaviour

Sebastien Bigaret Sebastien.Bigaret@inqual.com
18 Sep 2002 15:15:45 +0200


        Hi,

  I'm posting here since I suspect this is related to the python2.1 's
ExtensionClass, but I'm not sure, so please excuse me if this is OT ; however
I tried hard and failed to reproduce the problem with non-Persistent classes.

    The context: I'm trying to adapt the egenix's mxProxy so that the proxied
    object can be changed. The proxied objects all derives from
    Persistence.Persistent. And I get a SEGV I do not understand.

    Here is the description of the problem:


[1] in mxProxy.c I call PyObject_GetAttr

    #5  0x401c42a8 in mxProxy_GetattrObject (self=0x82d51f8, name=0x8167830)
        at mx/Proxy/mxProxy/mxProxy.c:960
    960		  v = PyObject_GetAttr((PyObject *)(self->object),name);
    (gdb) p self->object
    $1 = (PyObject *) 0x8249df0
    (gdb) p *self->object->ob_type
    [is OK]

[2] Then PyObject_GetAttr() is called, but there:

    #4  0x808d64a in PyObject_GetAttr (v=0x82d51a0, name=0x8167830)
        at Objects/object.c:1052
    1052			return (*v->ob_type->tp_getattro)(v, name);
    (gdb) p v
    $3 = (PyObject *) 0x82d51a0
                      ^^^^^^^^^

  => this is not the (PyObject*) with which I called the function!!

Then, at ExtensionClass/src/ExtensionClass.c:1651, the following statements
            1651	      r= INSTANCE_DICT(inst);

fails (SEGV), but is of course OK if applied with the correct object in [1].


  Does it make sense to anyone???

  Any help would be greatly appreciated.

-- Sebastien.