[capi-sig] Modify tp_getset or PyGetSetDef entries in run-time
mateusz at loskot.net
Fri Jul 6 14:40:51 CEST 2012
On 6 July 2012 13:35, Campbell Barton <ideasman42 at gmail.com> 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
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
More information about the capi-sig