Skip to content

Pythran fallback not used for numpy call #2126

Open

Description

@serge-sans-paille

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.

Activity

  1. serge-sans-paille commented on Mar 4, 2018

    @serge-sans-paille
    ContributorAuthor
  2. serge-sans-paille commented on Jan 20, 2020

    @serge-sans-paille
    ContributorAuthor

    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?

  3. scoder commented on Jan 24, 2020

    @scoder
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions