Commit e964556
committed
fix: replace TextIOWrapper with StringIO in CaptureStream to avoid uninitialized object error
CaptureStream inherited from TextIOWrapper without calling super().__init__(),
leaving the internal C struct (self->ok) at 0. When mypy (or other tools)
interacted with the stream, Python's C-level CHECK_INITIALIZED raised
'I/O operation on uninitialized object'.
Changed to inherit from StringIO which is a pure Python stream that doesn't
require C-level initialization, and updated get_hidden_stdout/get_hidden_stderr
to use getvalue() instead of the custom .contents attribute.1 parent 0a9d363 commit e964556
1 file changed
Lines changed: 7 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 17 | | |
25 | 18 | | |
26 | 19 | | |
| |||
47 | 40 | | |
48 | 41 | | |
49 | 42 | | |
50 | | - | |
| 43 | + | |
51 | 44 | | |
52 | 45 | | |
53 | | - | |
| 46 | + | |
54 | 47 | | |
55 | 48 | | |
56 | 49 | | |
| |||
0 commit comments