Commit 4a3cbe8
fix: stop newline translation corrupting stdio framing on Windows
stdio_server() wrapped sys.stdout.buffer in a TextIOWrapper with default
newline handling, which translates "\n" to os.linesep on write. On
Windows every outgoing frame was terminated with "\r\n", breaking the
newline-delimited JSON framing required by the spec.
Fix: newline="" on the stdout wrapper only. Outgoing frames must be
spec-exact; stdin keeps universal-newline reading so CRLF from clients
stays tolerated.
The regression test asserts on the raw bytes written to stdout, so the
platform's newline translation itself is under test: it fails on main on
Windows (b'...}\r\n') and passes with the fix. Runs on the
windows-latest CI cell.
Fixes #2433
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 3a6f299 commit 4a3cbe8
2 files changed
Lines changed: 35 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
108 | 139 | | |
109 | 140 | | |
110 | 141 | | |
| |||
0 commit comments