Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bound cpdef method with default argument causes "Cannot assign type" #551

Closed
jwilk opened this issue Aug 10, 2016 · 3 comments
Closed

Bound cpdef method with default argument causes "Cannot assign type" #551

jwilk opened this issue Aug 10, 2016 · 3 comments

Comments

@jwilk
Copy link
Contributor

jwilk commented Aug 10, 2016

For this code:

cdef class A:

    cpdef foo(self, str s, float f=0):
        pass

    def bar(self):
        foo = self.foo
        foo('foo', 3.14)

I get:

Error compiling Cython file:
------------------------------------------------------------
...
    cpdef foo(self, str s, float f=0):
        pass

    def bar(self):
        foo = self.foo
        foo('foo', 3.14)
           ^
------------------------------------------------------------

test.pyx:8:12: Cannot assign type 'str object' to 'A'

The problem goes away if I remove =0...

Tested with Cython 0.24.1

@jwilk
Copy link
Contributor Author

jwilk commented Aug 10, 2016

I bisected this; first bad commit is 767fce8.

@tobihan
Copy link

tobihan commented Nov 10, 2016

Hi! Could someone have a look at this please? In Debian we have the annoying situation that this is a release critical bug, so it prevents new versions of Cython to enter what will be the next Debian release. And we need to update Cython for Sagemath...

@robertwb
Copy link
Contributor

Thanks for the bisect. This was certainly an unintended side-effect of that patch. Looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants