Repository navigation
v0.8.1
Pyfun 0.8.1
A bugfix release. Both fixes came from a dogfooding round on a real Pyfun program (a Scrabble game
with an async spectator mode) built against 0.8.0.
Fixed
-
A module
mutassigned insideasync/seq/resultsilently bound a local instead of the
module binding. Every built-in computation expression lowers its body to its own nested Python
function (a coroutine forasync, a generator forseq, and so on), but that nested function was
missing theglobal/nonlocaldeclarations that ordinary function bodies get for capturedmut
assignments. The result: a flag flipped from inside anasync { }block never actually flipped,
with no error — the assignment just bound a fresh local that was thrown away.result {}'s
read-modify-write form hit the louderUnboundLocalErrorversion of the same bug. All four
built-in CE forms now get the same capture analysis as function bodies. (#122) -
A
unitparameter did not erase consistently across an extern's parameter list. A leading
unitbefore real parameters split the call in two instead of dropping
(unit -> int -> int = absapplied tomyAbs () (-5)emittedabs()(-5), calling the result of
abs()), and aunitin the middle of a parameter list was passed through as PythonNone
instead of vanishing (int -> unit -> int -> intemittedmax(3, None, 5)). The rule is now one
rule: aunitparameter contributes no argument, wherever it sits. Partial application of a
unit-slotted extern now closes over a lambda rather thanfunctools.partial(which cannot drop an
argument that has not arrived yet), and the fix reaches receiver methods, kwarg-slot externs, and
bare references the same way. (#123)
Breaking
- An extern's mid-list
unitargument no longer arrives as PythonNoneon the other side of the
boundary — it is dropped from the call entirely, matching how a leading/trailingunitalready
behaved. This only affects an extern binding that both declares a non-leadingunitparameter and
relies on the Python callee actually receivingNonethere; nothing in the standard library or
examples depended on the old behavior.