Commit 2504893
docs(worker): the mechanism was corrected everywhere EXCEPT the code it describes
Re-review of finding 1. Comments only; no behaviour change. pytest 31 passed.
b403c71 replaced a false reason for the unconditional await ("a loop that stops
yielding cannot be stopped") with a more careful one. Then the browser
experiment for finding 6 disproved the replacement too, and I updated the report
and trinket's spec — but not these three, which b403c71 had written hours
earlier and which still said the scene "freezes", with "no events dispatched, no
flush". So the same claim was wrong here twice in a row, the second time in the
one place a reader of _async_rate actually looks.
What the experiment showed — build with `if remaining <= 0.0: return`, sync,
run — is narrower and much harder to notice:
* the scene KEEPS ANIMATING; _flush_if_due() is synchronous, so outbound
updates need no yield at all;
* Stop KEEPS WORKING; terminate() needs nothing from this thread;
* INBOUND events silently stop arriving — the host delivers them by calling
__trinket_vpython_dispatch, which only gets a turn when the coroutine gives
one up.
Inbound dispatch is the only half that needs the yield. The failure mode is
therefore a scene that animates, a Stop button that works, and mouse events that
quietly do nothing — which is exactly why the first browser test written for it
passed against the broken build.
All three sites now say that, and each says the browser is where it was
established rather than presenting it as deduction. The docstring also notes why
the CPython test asserts a bystander coroutine instead: yielding is the
property, and a co-scheduled task is its only visible consequence here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7y9rTA1r8r8EhEnPSQenR1 parent 68eff8c commit 2504893
2 files changed
Lines changed: 36 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
| |||
224 | 232 | | |
225 | 233 | | |
226 | 234 | | |
227 | | - | |
228 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
138 | 135 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| |||
0 commit comments