• Kevin Modzelewski's avatar
    Change rearrangeArgs to taking a callback · 1a5e6053
    Kevin Modzelewski authored
    This function is complicated because it has so many return values (out-parameters).
    It also returns a decent amount of information about what the caller has to do
    after it is done with the args (decref them, decref the rewritten ones, etc), and
    the contract was getting very complicated.  It also had some complicated rules
    about how the caller had to set up certain input arguments.
    
    I also tried adding some optimizations to it, where it would sometimes not incref all
    of the returned args; I tried continuing the current scheme by passing back some information
    about which args needed to be decref'd or not.  This was really messy and was also a
    perf hit.
    
    So instead, switch it to being callback-based.  I think this should clean it up quite a bit
    and also open up some room for more optimizations.
    
    This commit is just a refactor -- it changes the name to rearrangeArgumentsAndCall, which takes
    a "continuation" callback.  For now it just calls rearrangeArguments under the hood.
    1a5e6053
capi.cpp 60.5 KB