1. 23 Sep, 2021 1 commit
  2. 21 Sep, 2021 1 commit
  3. 17 Sep, 2021 1 commit
  4. 01 Sep, 2021 1 commit
  5. 28 Jul, 2021 3 commits
  6. 13 Jul, 2021 6 commits
  7. 25 May, 2021 1 commit
  8. 20 Jan, 2021 3 commits
  9. 05 Jan, 2021 2 commits
  10. 04 Jan, 2021 5 commits
  11. 29 Dec, 2020 6 commits
  12. 22 Dec, 2020 3 commits
  13. 21 Dec, 2020 2 commits
  14. 18 Dec, 2020 4 commits
  15. 17 Dec, 2020 1 commit
    • 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