-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-141930: Use the regular IO stack to write .pyc files for a better error message on failure #141931
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
Interruption by a system call or something is not completely unexpected. Retry the write with the remaining data.
4d74676 to
914caf1
Compare
|
Squashed in that suggestion to avoid the CLA bot. |
cee386f to
c8ba03f
Compare
Misc/NEWS.d/next/Core_and_Builtins/2025-11-24-21-09-30.gh-issue-141930.hIIzSd.rst
Outdated
Show resolved
Hide resolved
vstinner
left a comment
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.
LGTM
gpshead
left a comment
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.
I reworded the news and title because "retry" and "retried" imply the wrong thing. The important thing is that the write will be "complete" so that's the word I put in NEWS or we'll get the actual underlying error.
…etter error message on failure (pythonGH-141931) * Use open() to write the bytecode * Convert to unittest style asserts * Tweak news, thanks @vstinner * Tidy * reword NEWS, avoid word "retried" (cherry picked from commit 656a64b) Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
|
Sorry, @stefanor and @gpshead, I could not cleanly backport this to |
|
GH-142021 is a backport of this pull request to the 3.14 branch. |
|
GH-142023 is a backport of this pull request to the 3.13 branch. |
Writes are not guaranteed to complete by the operating system. Use the normal file object to do the necessary retries and raise appropriate errors, if we fail to completely write a
.pycfile in one syscall..pycif unable to completely write a.pycfile in one go #141930