This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregcouch
Recipients gregcouch, loewis
Date 2009-02-18.00:04:26
SpamBayes Score 3.4852154e-10
Marked as misclassified No
Message-id <1234915468.96.0.615090620382.issue1229239@psf.upfronthosting.co.za>
In-reply-to
Content
FYI, I was able to work around this and use an unmodified Python by
subtyping type and overriding the setattr method as shown below.  It's a
lot messier than patching Python.

static int
Mutable_SetAttr(PyObject *obj, PyObject *name, PyObject *value)
{
        // Can't just call PyObject_GenericSetAttr because
        // we need to able to update the __str__ slot as well.
        PyTypeObject *type = reinterpret_cast<PyTypeObject*>(obj);
        type->tp_flags |= Py_TPFLAGS_HEAPTYPE;
        int result = PyType_Type.tp_setattro(obj, name, value);
        type->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
        return result;
}
History
Date User Action Args
2009-02-18 00:04:29gregcouchsetrecipients: + gregcouch, loewis
2009-02-18 00:04:28gregcouchsetmessageid: <1234915468.96.0.615090620382.issue1229239@psf.upfronthosting.co.za>
2009-02-18 00:04:27gregcouchlinkissue1229239 messages
2009-02-18 00:04:26gregcouchcreate