On 6 July 2012 13:35, Campbell Barton firstname.lastname@example.org wrote:
While this isnt impossible - its definetly not intended, when python runs PyType_Ready() it converts the PyGetSetDef's into PyObject's attribute descriptors which are stored in the PyType's dictionary. so strongly advice against trying to manipulate that data at low level...
That's what I thought indeed.
- you could look at assigning properties to a class as can be done in python...
MyClass.foo = property(getx, setx, delx, "This is a property")
... doing in C will be more verbose of course but it should work fine.
It is a very interesting option, though I'm running out of either C API fu or imagination how to make such thing at C API level...without fiddling with PyGetSetDef table.
If Python sources make use of it, I could grasp it easily, but what to look there at? Would you mind pointing where to learn some details?
Mateusz Loskot, http://mateusz.loskot.net