Opened 3 years ago

Last modified 3 years ago

#20860 new defect

sage_getargspec on Cython class instances prefers __init__ over __call__

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-7.3
Component: documentation Keywords:
Cc: SimonKing, nthiery Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

The following Cython code

cimport cython
@cython.embedsignature(True)
cdef class MyClass(object):
    def __init__(self, x):
        pass
        
    def __call__(self, y):
        pass
        
from sage.misc.sageinspect import sage_getargspec
print(sage_getargspec(MyClass("hello")))

gives the argspec of __init__ instead of __call__:

ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)

Change History (1)

comment:1 Changed 3 years ago by jdemeyer

  • Cc nthiery added
Note: See TracTickets for help on using tickets.