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

mio5_utils.pyx cythonizing fails with Cython 0.17 (Trac #1707) #2226

Closed
scipy-gitbot opened this issue Apr 25, 2013 · 4 comments
Closed

mio5_utils.pyx cythonizing fails with Cython 0.17 (Trac #1707) #2226

scipy-gitbot opened this issue Apr 25, 2013 · 4 comments
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.io
Milestone

Comments

@scipy-gitbot
Copy link

Original ticket http://projects.scipy.org/scipy/ticket/1707 on 2012-07-24 by @rgommers, assigned to trac user mbrett.

From #274

$ cython  -V
Cython version 0.17.beta1
$ cython mio5_utils.pyx 
warning: mio5_utils.pyx:302:16: Unreachable code
warning: mio5_utils.pyx:481:12: Unreachable code

Error compiling Cython file:
------------------------------------------------------------
...
            mod8 = byte_count % 8
            if mod8:
                self.cstream.seek(8 - mod8, 1)
        return 0

    cpdef inline cnp.ndarray read_numeric(self, int copy=True):
         ^
------------------------------------------------------------

mio5_utils.pyx:412:10: Only final types can have final Python (def/cpdef) methods

With Cython 0.16 there's no problem. The explanation by bfroehle on the PR is:

It isn't possible to have an inline'd def or cpdef method, as
otherwise you'd get conflicting results depending on whether you 
called the method from C or Python if a subclass overrode the method.
@scipy-gitbot
Copy link
Author

@rgommers wrote on 2012-07-24

PR already has a suggested fix.

@scipy-gitbot
Copy link
Author

trac user bfroehle wrote on 2012-07-24

The fix should be a simple patch (+ recompiling with Cython). See also https://groups.google.com/forum/?fromgroups#!topic/cython-users/4EeMY_6ATqs for more background on why this is a compile failure.

--- a/scipy/io/matlab/mio5_utils.pyx
+++ b/scipy/io/matlab/mio5_utils.pyx
@@ -409,7 +409,7 @@ cdef class VarReader5:
                 self.cstream.seek(8 - mod8, 1)
         return 0

-    cpdef inline cnp.ndarray read_numeric(self, int copy=True):
+    cpdef cnp.ndarray read_numeric(self, int copy=True):
         ''' Read numeric data element into ndarray

         Reads element, then casts to ndarray. 

@scipy-gitbot
Copy link
Author

@pv wrote on 2012-11-25

c0f0fa2a

@scipy-gitbot
Copy link
Author

Milestone changed to 0.12.0 by @pv on 2012-11-25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.io
Projects
None yet
Development

No branches or pull requests

1 participant