Accessing __slots__ from C

Chris ceball at users.sourceforge.net
Tue Sep 16 19:34:27 EDT 2008


Hrvoje Niksic <hniksic <at> xemacs.org> writes:
...
> > You are getting that error because Carl forgot to cast the descriptor
> > to the appropriate C type, in this case PyMemberDescrObject.  The last
> > line is also incorrect, I think.  Try something like this:
...

The code you gave was great, thanks! Now we have done exactly what we
wanted, and have fast access from C to two particular attributes of
instances of a particular class.

We use that fast access in optimized versions of pure-Python
components of our simulator. 

Chris





More information about the Python-list mailing list