cython.embedsignature does not embed signature for __call__ or __init__ #1577

Open
jbweston opened this Issue Jan 10, 2017 · 1 comment

Projects

None yet

1 participant

@jbweston

I see the following problem with Cython version 0.25.2.

When cythonizing the following file:

import cython

cdef class Test:

    @cython.embedsignature
    def __call__(self, a, b):
        "sig for __init__"

    @cython.embedsignature
    def __call__(self, a, b):
        "sig for __call__"

    @cython.embedsignature
    def test_method(self, a, b):
        "sig for test_method"

Cython produces the following docstring declarations:

// ...snip...
static char __pyx_doc_4test_4Test___call__[] = "sig for __init__";
// ...snip...
static char __pyx_doc_4test_4Test_2__call__[] = "sig for __call__";
// ...snip...
static char __pyx_doc_4test_4Test_4test_method[] = "Test.test_method(self, a, b)\nsig for test_method";

I would expect the signatures for the __init__ and __call__ methods to be created.

@jbweston jbweston changed the title from `cython.embedsignature` does not embed signature for `__call__` or `__init__` to cython.embedsignature does not embed signature for __call__ or __init__ Jan 10, 2017
@kwant-bot kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Jan 11, 2017
@jbweston jbweston document __call__ method if it exists
For cython extension modules, the method signature for __call__
is still not embedded properly.
See cython/cython#1577.
964f947
@kwant-bot kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Jan 11, 2017
@jbweston jbweston document __call__ method if it exists
For cython extension modules, the method signature for __call__
is still not embedded properly.
See cython/cython#1577.
32a78ff
@jbweston

It appears that this behaviour is caused by this block, whereby any special (dunder) method except __init__ is ignored by embedsignature

Can anyone clarify the reasoning behind this choice?

@kwant-bot kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Jan 13, 2017
@jbweston jbweston document __call__ method if it exists
For cython extension modules, the method signature for __call__
is still not embedded properly.
See cython/cython#1577.
0bb7737
@kwant-bot kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Jan 13, 2017
@jbweston jbweston document __call__ method if it exists
For cython extension modules, the method signature for __call__
is still not embedded properly.
See cython/cython#1577.
731dab2
@kwant-bot kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Feb 2, 2017
@jbweston jbweston document __call__ method if it exists
For cython extension modules, the method signature for __call__
is still not embedded properly.
See cython/cython#1577.
c2886f2
@kwant-bot kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Feb 2, 2017
@jbweston jbweston document __call__ method if it exists
For cython extension modules, the method signature for __call__
is still not embedded properly.
See cython/cython#1577.
342a94c
@kwant-bot kwant-bot pushed a commit to kwant-project/kwant that referenced this issue Feb 2, 2017
@jbweston jbweston correctly document `__call__` for operators
Also improve the documentation for operators in general.

special methods are not included by autodocs by default, and
as class documentation pages are generated by autosummary,
we cannot just explicitly include __call__. We get around this
by using a custom autosummary template for the operator classes.

For cython extension modules, the method signature for __call__
is still not embedded properly.
See cython/cython#1577.
8fc151e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment