Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Nov 29, 2025

Fix inconsistent subprocess.Popen.communicate() behavior between Windows
and POSIX when using memoryview objects with non-byte elements as input.

On POSIX systems, the code was incorrectly comparing bytes written against
element count instead of byte count, causing data truncation for large
inputs with non-byte element types.

Changes:

  • Cast memoryview inputs to byte view when input is already a memoryview
  • Fix progress tracking to use len(input_view) instead of len(self._input)
  • Add comprehensive test coverage for memoryview inputs

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

  • old-man-yells-at-ReST
  • Update 2025-05-30-18-37-44.gh-issue-134453.kxkA-o.rst
  • assertIsNone review feedback
  • fix memoryview_nonbytes test to fail without our fix on main, and have a nicer error.

Thanks to Peter Bierma @ZeroIntensity for the code review.
(cherry picked from commit cc6bc4c)

Co-authored-by: Gregory P. Smith [email protected]

…ythonGH-134949)

Fix inconsistent subprocess.Popen.communicate() behavior between Windows
and POSIX when using memoryview objects with non-byte elements as input.

On POSIX systems, the code was incorrectly comparing bytes written against
element count instead of byte count, causing data truncation for large
inputs with non-byte element types.

Changes:
- Cast memoryview inputs to byte view when input is already a memoryview
- Fix progress tracking to use len(input_view) instead of len(self._input)
- Add comprehensive test coverage for memoryview inputs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* old-man-yells-at-ReST
* Update 2025-05-30-18-37-44.gh-issue-134453.kxkA-o.rst
* assertIsNone review feedback
* fix memoryview_nonbytes test to fail without our fix on main, and have a nicer error.

Thanks to Peter Bierma @ZeroIntensity for the code review.
(cherry picked from commit cc6bc4c)

Co-authored-by: Gregory P. Smith <[email protected]>
@gpshead gpshead enabled auto-merge (squash) November 29, 2025 04:41
@gpshead gpshead disabled auto-merge November 29, 2025 06:37
@gpshead gpshead enabled auto-merge (squash) November 29, 2025 06:42
@gpshead gpshead merged commit 704bb69 into python:3.13 Nov 29, 2025
74 of 76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants