[Pyrex] C methods in extension types

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Oct 9 05:13:40 CEST 2003


> cdef class Row:
> 
>   def __new__(self, table):
>     self._table = table
> 
>   def __next__(self):
>        self.recout = self._table._read_records(self.nrowsread, 
>             self.nrowsinbuf)

If that's the entire definition of your Row class, then
the _table is being stored as a Python attribute, and when you
come to retrieve it, Pyrex doesn't know that it's of type Table,
and therefore can't call any of its C methods.

You need to declare _table as being a C attribute, e.g.

  cdef class Row:

    cdef Table _table

    ...

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list