File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -751,6 +751,21 @@ def cc(*rets, **kwrets):
751751 if cc1 is not None :
752752 @passthrough_lazy_args
753753 def cc (return_value ):
754+ # Return values are never implicitly lazy in `unpythonic`,
755+ # so why we need to `force1` here requires a comment.
756+ #
757+ # In general, we should treat these `cc` functions as lazy,
758+ # so they won't force their args. Those args here are a return value,
759+ # but due to `continuations`, it's not just a return, but a call
760+ # into the `cc` function.
761+ #
762+ # Thus, returning a `Values` from a continuation-enabled function,
763+ # that `Values` ends up here (or in the other branch, with no `cc1`).
764+ # Because it's *technically* an argument for a lazy function, it gets
765+ # a `lazy[]` wrapper added by `with lazify`.
766+ #
767+ # To determine whether we have one or multiple return values, we must
768+ # force that wrapper promise, without touching anything inside.
754769 return_value = force1 (return_value )
755770 if isinstance (return_value , Values ):
756771 return jump (cc1 , cc = cc2 , * return_value .rets , ** return_value .kwrets )
You can’t perform that action at this time.
0 commit comments