Repository navigation
INT-GEN-01: Adopt generators and comprehensions #120
Description
Scope
- Specify generator construction, yield/yield from, send/throw/close and suspended ownership before admitting the syntax.
- Adopt list/dict/set/generator comprehensions with Python scope and evaluation order. Cover finally, exhaustion, exceptions and cancellation. Coordinate parked ownership with INT-10: Implement asynchronous execution and browser host adapters #34 without requiring the full async application milestone.
Evidence and limits
Pinned CPython 3.14.7 is the semantic oracle. Run independently compiled Python source in Node and Chromium; record supported signatures, explicit refusals and zero logical teardown. Core-source and classes-source admission remain explicit. Library/package coverage, browser capabilities and native ABI support are separate claims. No publication or deployment is included.
Dependencies and readiness
- INT-ITER-01: Adopt iteration and containment protocols #113
- INT-FUNC-01: Expand function binding and scope mutation #118
Readiness: Ready. Iteration #113 and function binding #118 are accepted on main. Dependent work may use focused stacked PRs.
Tracked by the versioned broad-compatibility inventory in #99. The parent class milestone #33 and async milestone #34 remain open.
Finite generator/object checkpoint — 2026-10-26
Merged #240, #241, #242, #243, #244 and the focused diagnostic correction #246. Final main is a760a5bceb16e3d210c15edc79f1fbd2594e639c; all five final-main CI jobs pass. Each dependent tree and focused diff was preserved after the actual parent squash and fresh checks, without rewriting shared history. All six child issues are closed and their Project items are Done.
- INT-GEN-01A: Define generator and object protocol contracts #235 — G1/G2 and O1/O2 contracts and authored CPython 3.14.7 references.
- INT-GEN-01B: Execute owned suspended generators #236 — owned suspended generator functions; eager binding, yield/yield-from, next/send/one-argument throw/close, return values, finally, reentry and escaping StopIteration handling.
- INT-GEN-01C: Compile scoped comprehensions #237 — scoped list/dict/set/generator comprehensions, nested for/if, unpacking and eager outer iterator acquisition.
- INT-GEN-02: Preserve injected generator exception source frames #245 — injected exception source frames/context and inactive root-scope release.
The finite generator contract is delivered in both source profiles. The composed example also exercises reflection and arithmetic.
Validation: 368 Node tests and 60 Python tests; generators have 36 class and 33 shared core observations across all eight Node/Chromium, drain/step, class/core combinations. Object protocols have 46 observations across four target/driver combinations. The twelve retained protocol reports contain 460 passing observations, 436 measured zero logical teardown records and 40 exact injected frame/context observations. Their corpora and 55 source/script hashes match final main. Offline acceptance has 416 program comparisons, 42 acceptance groups and 90 Stop/Restart cycles. The eight prior composed resource baselines remain unchanged. Both demonstration consoles build. No dependency, host capability, release, publication or deployment change is included.
This parent remains open / In Progress for comprehension assignment expressions, deprecated multi-argument throw, generator introspection and stronger finalization behavior through separate finite contracts. Hard cancellation/session shutdown releases ownership without executing arbitrary finalizers. Native async generators/comprehensions, persistent sessions and host scheduling remain under #34. The object construction/reflection continuation remains #123.
Activity