FA-90187 / Bytecode virtual machines / Member archive
Generators: falsy non-None first send accepted · case 02
send(0) to a fresh generator starts it instead of raising TypeError.
Case contract
A generator frame runs body ops push v, pop, add, yield (pop and hand out a value, suspend), return (pop, finish with StopIteration value), try exc target / endtry (handler stack; handler "Exception" catches any thrown name). Commands: next (= send None) and send v resume; resuming a suspended frame pushes the sent value as the result of its yield; sending non-None to a never-started generator is ["TypeError"]; a finished generator answers ["StopIteration", None]. throw into a created or finished generator finishes it with ["raised", exc]; otherwise the innermost matching handler is jumped to, or the generator finishes and re-raises. close finishes the generator. Frame faults are ["vm-error"].
Why this case matters
Generator state transitions (created/suspended/done) and send/throw semantics are easy to get subtly wrong.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| non-None send to a fresh generator | [["yielded", 1], ["vm-error"], ["StopIteration", null]] | [["TypeError"], ["yielded", 1], ["yielded", 12]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗