Ticket #673 (new defect)
Bound methods of cdef classes acts differently from normal classes (with f2py?)
| Reported by: | dagss | Owned by: | dagss |
|---|---|---|---|
| Priority: | major | Milestone: | 0.17 |
| Component: | Code Generation | Keywords: | |
| Cc: |
Description
This code:
"""
>>> solve()
"""
import numpy as np
import scipy.integrate
class Rhs:
def f(self, x, y):
return np.zeros_like(y)
def solve():
# Options for the ODE solver
rhs = Rhs()
integrator = scipy.integrate.ode(rhs.f)
integrator.set_initial_value([1, 2, 3], 0)
integrator.integrate(1)
Results in:
Exception raised:
Traceback (most recent call last):
File "/home/dagss/opt/epd/lib/python2.7/doctest.py", line 1254, in __run
compileflags, 1) in test.globs
File "<doctest boundmethod[0]>", line 1, in <module>
solve()
File "boundmethod.pyx", line 17, in boundmethod.solve (boundmethod.c:735)
File "/home/dagss/opt/epd/lib/python2.7/site-packages/scipy/integrate/ode.py", line 326, in integrate
self.f_params,self.jac_params)
File "/home/dagss/opt/epd/lib/python2.7/site-packages/scipy/integrate/ode.py", line 572, in run
y1,t,istate = self.runner(*(args[:5]+tuple(self.call_args)+args[5:]))
File "boundmethod.pyx", line 9, in boundmethod.Rhs.f (boundmethod.c:546)
TypeError: f() takes exactly 3 positional arguments (1 given)
HOWEVER, if "class" is changed to "cdef class", everything works splendidly.
This may be a problem of f2py and not Cython's fault at all.
Change History
Note: See
TracTickets for help on using
tickets.
