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

Accessing memoryview .shape raises at compile-time #2689

jbrockmendel opened this Issue Oct 27, 2018 · 0 comments


None yet
1 participant

jbrockmendel commented Oct 27, 2018

def row_bool_subset_object(object[:, :] values,
                           ndarray[uint8_t, cast=True] mask):
        Py_ssize_t i, j, n, k, pos = 0
        object[:, :] out

    n, k = values.shape

pandas/_libs/lib.pyx:709:17: Assignment to/from slice of wrong length, expected 8, got 2
Traceback (most recent call last):
  File "", line 727, in <module>
    ext_modules=maybe_cythonize(extensions, compiler_directives=directives),
  File "", line 479, in maybe_cythonize
    return cythonize(extensions, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/Cython/Build/", line 1026, in cythonize
  File "/usr/local/lib/python2.7/site-packages/Cython/Build/", line 1146, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pandas/_libs/lib.pyx

Another error I'm getting in the same file:

This works:

def has_infs_f4(float32_t[:] arr) -> bint:

Changing it to this raises:

def has_infs_f4(arr: float32_t[:]) -> bint:

And last a question as long as I'm stretching my luck:
Are py3-style type annotations actually used by cython on non-cdef/cpdef functions? I incorrectly wrote a return type as bint instead of str and it didn't cause any test/compile failures, making me wary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment