- 29 Dec, 2020 1 commit
-
-
Xavier Thompson authored
-
- 22 Dec, 2020 3 commits
-
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
- 21 Dec, 2020 2 commits
-
-
Xavier Thompson authored
-
Xavier Thompson authored
-
- 18 Dec, 2020 4 commits
-
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
- 17 Dec, 2020 2 commits
-
-
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.
-
Xavier Thompson authored
-
- 15 Dec, 2020 5 commits
-
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
- 14 Dec, 2020 1 commit
-
-
Xavier Thompson authored
-
- 11 Dec, 2020 3 commits
-
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
- 10 Dec, 2020 9 commits
-
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
- 09 Dec, 2020 10 commits
-
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-
Xavier Thompson authored
-