• Xavier Thompson's avatar
    Change cypclass reference counting convention · 98a93bc2
    Xavier Thompson authored
    This changes the reference counting convention for passing cyobjects
    as arguments in a function call.
    
    Before this commit, cyobjects used the same convention as pyobjects:
    - The function borrows a reference on the argument from the caller
      and the caller keeps ownership of the object passed as argument,
      and must eventually decref it, even if it is a temporary rvalue
      that will not be reachable in the caller's scope after the call.
    - If the function needs to take ownership of the argument, e.g. to
      store it, it must increment its reference count first, at which
      point the caller and callee both own a reference to the object.
    - If the callee does not take ownership of the argument, it should
      not decrement its reference count at any point.
    
    After this commit, the convention for cyobjects is as follows:
    - The function steals the reference on the argument from the caller,
      and the caller should not decrement its reference count after the
      call.
    - If the o...
    98a93bc2