Skip to content

Commit

Permalink
Forbid transferring arguments at a callsite level
Browse files Browse the repository at this point in the history
As titled.
  • Loading branch information
apmasell committed Jul 28, 2023
1 parent f0cae83 commit c7d5857
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dispyatcher/cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def create_flow(self,
arg_types: Sequence[Tuple[Type, ArgumentManagement]]) -> F:
assert not isinstance(return_type, PyObjectType) or return_management == ReturnManagement.TRANSFER,\
"A Python control flow must return an owned object."
for idx, (arg_ty, arg_mgmt) in enumerate(arg_types):
assert arg_mgmt in (ArgumentManagement.BORROW_TRANSIENT,
ArgumentManagement.BORROW_CAPTURE,
ArgumentManagement.BORROW_CAPTURE_PARENTS),\
f"Argument {idx} of type {arg_ty} is {arg_mgmt.name}, but this not allowed at a callsite level"

return PythonControlFlow(state, return_type.machine_type())

Expand Down

0 comments on commit c7d5857

Please sign in to comment.