Ralf Schmitt schrieb:
> Hi all,
> 
> I've been trying to port our software to python 2.5.
> unfortunately I'm getting constantly hit by segfaults.
> 
> I've boiled it down to the following code:
> 
> [EMAIL PROTECTED]:~/bug$ cat t.py
> import array
> 
> class Indexer(object):
>      maximumForwardSize = property(array.array.fromstring)
> [EMAIL PROTECTED]:~/bug$ python t.py
> Segmentation fault

Confirmed under Windows.  Here's the problem (Objects/descrobject.c, near line 
1200,
in property_init(...):


        /* if no docstring given and the getter has one, use that one */
        if ((doc == NULL || doc == Py_None) && get != NULL && 
            PyObject_HasAttrString(get, "__doc__")) {
                if (!(get_doc = PyObject_GetAttrString(get, "__doc__")))
                        return -1;
                Py_DECREF(get_doc); /* it is INCREF'd again below */
                ^^^^^^^^^^^^^^^^^^
                doc = get_doc;
        }

        Py_XINCREF(get);
        Py_XINCREF(set);
        Py_XINCREF(del);
        Py_XINCREF(doc);

If the refcount of get_doc drops to zero in the Py_DECREF(), the Py_XINCREF()
shortly after doesn't help ;-).

Thomas

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to