Message82391
| 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:29 | gregcouch | set | recipients:
+ gregcouch, loewis |
| 2009年02月18日 00:04:28 | gregcouch | set | messageid: <1234915468.96.0.615090620382.issue1229239@psf.upfronthosting.co.za> |
| 2009年02月18日 00:04:27 | gregcouch | link | issue1229239 messages |
| 2009年02月18日 00:04:26 | gregcouch | create |
|