• da-woods's avatar
    Relaxed some of the checks on calling fused functions (GH-3381) · 2ca3f569
    da-woods authored
    Relaxed some of the checks of fused functions to be consistent with general CyFunctions.
    
    ```
     # cython: binding=True
    def f(arg):
      pass
    
    class C:  # or cdef class...
      f = f
      def g(self, ...):
        pass
    
    C.f(something) or C().f() # doesn't enforce any checks on the type of arg -
     # with a fused function it does.
    
    C.g(something) # assumes that self is "C" (at least for a cdef class)
     # but doesn't check it. A fused function enforces that it is C.
    
    C.f() # fails with a fused function claiming too few arguments, even though
     # default arguments may make it a valid call
    ```
    
    Obviously removing checks does make things a little less safe, but it
    is consistent with the more general function behaviour. (I'm doing
    this as part of a broad plan to abuse fused functions to be a bit
    cleverer about decorators, but I don't think the motivation hugely
    matters for this change)
    2ca3f569
fused_bound_functions.py 4.4 KB