[Pyrex] 'cdef'ed methods are always static?

Helmut Jarausch jarausch at skynet.be
Tue Feb 21 18:50:27 CET 2006


Hi

is this a bug in Pyrex ?

cdef int Key(int x):
  return 3*x

cdef class IT:
  cdef int (*Fct)(int)
  def __new__(self): pass
  cdef void set_Fct(self,int (*FPtr)(int)):
    self.Fct= FPtr

  def display(self,int count):
    print "Key=",self.Fct(count)

def call_Key(int parm):
  ITC=IT()
  IT.set_Fct(ITC,Key)   # This works just fine
#  ITC.set_Fct(Key)     # This doesn't work     <=====
  ITC.display(parm)

Test by the script

#!/usr/local/bin/python
import CallTest

CallTest.call_Key(7)


Many thanks for your help,
Helmut

-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



More information about the Pyrex mailing list