Commit 0554fe0
committed
Add returncode property to FallbackProcess; simplify returncode guard
FallbackProcess stands in for anyio.abc.Process on Windows with
SelectorEventLoop, but was missing the returncode property that Process
declares abstractly. This meant getattr(proc, "returncode", None) in
_terminate_and_reap always returned the default None for FallbackProcess,
so the double-terminate guard never fired (the docstring's 'Idempotent'
claim was false for half the declared union type).
Practical impact was near-zero — FallbackProcess is only active under
SelectorEventLoop (not the default since Python 3.8, not used in CI),
and terminate_windows_process_tree swallows all exceptions on the second
call. But the fix is trivial and brings FallbackProcess closer to the
interface it's supposed to implement.
With returncode present on both union members, the getattr can become a
direct attribute access, which also satisfies pyright without defensive
indirection.
Github-Issue: #17751 parent d8c7de2 commit 0554fe0
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| |||
0 commit comments