Skip to content

Pythran fallback not used for numpy call #2126

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

Open
serge-sans-paille opened this issue Mar 4, 2018 · 3 comments
Open

Pythran fallback not used for numpy call #2126

serge-sans-paille opened this issue Mar 4, 2018 · 3 comments

Comments

@serge-sans-paille
Copy link
Contributor

Investigating the C++ code generated from

# cython: np_pythran=True

from __future__ import absolute_import

import numpy as np
cimport numpy as np
cimport cython

def roll(np.int8_t[::1] state, Py_ssize_t idx):
    return np.roll(state, -idx, axis=0)

shows that Pythran is not used to implement np.roll, while there's support for that in Pythran.

@serge-sans-paille
Copy link
Contributor Author

cc @aguinet !

@serge-sans-paille
Copy link
Contributor Author

Got it! It's because of the keyword argument.

@scoder would that make sense to turn keyword argument into normal argument based on the inspect.getfullargspec information for pythran candidates?

@scoder
Copy link
Contributor

scoder commented Jan 24, 2020

Why not use the signatures in pythran.tables.MODULES instead? They don't appear to know the names of their arguments, but – shouldn't they?

Also see GeneralCallNode.map_to_simple_call_node(), which does this transformation (for keyword arguments to C functions), so the main thing that you need is a Cython function type for the target signature.

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

No branches or pull requests

2 participants