[Pyrex] C methods in extension types

Francesc Alted falted at openlc.org
Wed Oct 8 18:21:00 CEST 2003


A Dimecres 08 Octubre 2003 04:24, Greg Ewing va escriure:
> I don't have a real-life example to hand, but I'll be making extensive

Well, I've made a try with a couple of extension types; the first one is
defined, very succinctly, as:

cdef class Table:

  def _read_records(self, hsize_t start, hsize_t nrecords):

and I used to call this method from other extension class (in the same Pyrex
file), in the form:

cdef class Row:

  def __new__(self, table):
    self._table = table

  def __next__(self):
       self.recout = self._table._read_records(self.nrowsread, 
self.nrowsinbuf)

but after changing the Table._read_records method to a C function (def -->
cdef), everything compiles well under pyrex 0.9, albeit I get this error in
execution time:

File "/home/falted/PyTables/pytables-0.8/src/hdf5Extension.pyx", line 1606, in 
hdf5Extension.Row.__next__
  self.recout = self._table._read_records(self.nrowsread,
AttributeError: 'Table' object has no attribute '_read_records'

Am I missing something?

Thanks,

-- 
Francesc Alted





More information about the Pyrex mailing list