Commit ec2bf58
fix: make ReadBuffer.clear() unpoison the buffer
ReadBuffer.clear() and ReadBuffer.reset() were silently asymmetric:
reset() (added alongside the poison concept in issue 026) cleared
_poisoned, while clear() (which predated the poison concept) did not.
A caller reaching for clear() as "the simpler recovery primitive"
got a half-fresh buffer: bytes gone, offset reset, but still
raising ProtocolError from the poison gate on the next operation.
Make clear() a thin alias for reset(). Behaviourally equivalent for
a clean buffer, correct for a poisoned one. This is also a
prerequisite for gating the ReadBuffer public API on the poison
flag (issue 038), since otherwise any caller who used clear() as
their recovery path would be locked out.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4315493 commit ec2bf58
2 files changed
Lines changed: 40 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
190 | 219 | | |
191 | 220 | | |
192 | 221 | | |
| |||
0 commit comments