-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-110673: test_pty raises on short write #110677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I convert to a draft until I collect most (if not all) buildbot reports. |
Lib/test/test_pty.py
Outdated
@@ -76,6 +76,17 @@ def expectedFailureIfStdinIsTTY(fun): | |||
pass | |||
return fun | |||
|
|||
|
|||
def write_all(fd, data): | |||
while True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. My first implementation (before I created this PR) actually implemented write_all(): retry os.write() until all bytes are written. But I was told that it must not happend, so I changed my PR to raise an exception instead.
I will remove the loop until buildbots complete, before merging this change.
At least, with this change, if the test hangs again, we will know for sure that no short write occurred.
Add write_all() helper function to test_pty to raise an exception on short write: if os.writes() does not write all bytes. It should not happen for a PTY.
9b3d056
to
b5ebb45
Compare
test_pty was run on a wide range of CI, GitHub Action and buildbots and it didn't fail. There were failures, but all unrelated. |
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Add write_all() helper function to test_pty to raise an exception on short write: if os.writes() does not write all bytes. It should not happen for a PTY. (cherry picked from commit b4e8049) Co-authored-by: Victor Stinner <vstinner@python.org>
GH-110742 is a backport of this pull request to the 3.12 branch. |
GH-110743 is a backport of this pull request to the 3.11 branch. |
Add write_all() helper function to test_pty to raise an exception on short write: if os.writes() does not write all bytes. It should not happen for a PTY. (cherry picked from commit b4e8049) Co-authored-by: Victor Stinner <vstinner@python.org>
Add write_all() helper function to test_pty to raise an exception on short write: if os.writes() does not write all bytes. It should not happen for a PTY.
Add write_all() helper function to test_pty to raise an exception on short write: if os.writes() does not write all bytes. It should not happen for a PTY. Let's check if this assumption is correct.