1. 21 Dec, 2020 2 commits
  2. 18 Dec, 2020 4 commits
  3. 17 Dec, 2020 2 commits
    • 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 object will still be reachable in the caller's scope after
        the call the caller must increment its reference count __before__
        the call to retain ownership of its reference after the call.
      - The function has ownership of the reference received as argument,
        and must decref it when if goes out of scope.
      
      The main reason for this change is to make it possible to 'consume'
      an argument from within a function. Before this change there was no
      reliable way to determine from within the function whether the caller
      would retain a reference on the argument after the call, which is
      required when the 'consume' operation needs a runtime check.
      
      The 'self' argument in a cypclass method is currently still an
      exception to this change: it still follows the previous convention.
      98a93bc2
    • Xavier Thompson's avatar
      0790e362
  4. 15 Dec, 2020 5 commits
  5. 14 Dec, 2020 1 commit
  6. 11 Dec, 2020 3 commits
  7. 10 Dec, 2020 9 commits
  8. 09 Dec, 2020 14 commits