Commit df8f082
Fix memoryview and closed stdin handling in _communicate_streams_posix
Apply the same fixes from Popen._communicate() to _communicate_streams_posix
for run_pipeline():
1. Handle non-byte memoryview input by casting to byte view (gh-134453):
Non-byte memoryviews (e.g., int32 arrays) had incorrect length tracking
because len() returns element count, not byte count. Now cast to "b"
view for correct progress tracking.
2. Handle ValueError on stdin.flush() when stdin is closed (gh-74389):
Ignore ValueError from flush() if stdin is already closed, matching
the BrokenPipeError handling.
Add tests for memoryview input to run_pipeline:
- test_pipeline_memoryview_input: basic byte memoryview
- test_pipeline_memoryview_input_nonbyte: int32 array memoryview
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent d420f29 commit df8f082
2 files changed
+54
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
543 | 547 | | |
544 | 548 | | |
545 | 549 | | |
546 | 550 | | |
547 | 551 | | |
548 | 552 | | |
549 | 553 | | |
550 | | - | |
551 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
552 | 562 | | |
553 | 563 | | |
554 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2019 | 2019 | | |
2020 | 2020 | | |
2021 | 2021 | | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
2022 | 2064 | | |
2023 | 2065 | | |
2024 | 2066 | | |
| |||
0 commit comments