-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-135648: Document that shutil.copyfileobj
doesn't flush
#135737
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
base: main
Are you sure you want to change the base?
Conversation
The documentation for :func:`shutil.copyfileobj` now warns the user of the | ||
need to close or flush the destination stream on completion. |
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.
The Documentation
blurb section is usually used for meta changes, e.g. tags or theme, and not entries about changes in the docs?
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 don't think that a NEWS entry is needed.
with urlopen( | ||
"https://github.com/libffi/libffi/releases/download/v3.4.6/libffi-3.4.6.tar.gz" | ||
) as response: | ||
shutil.copyfileobj(response, tmp_file) | ||
tmp_file.close() |
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.
Could we do tmp_file.flush()
and remove delete_on_close=False
?
Thanks @freakboy3742! |
Document that
shutil.copyfileobj()
doesn't flush the destination stream on completion, so file content may not be reliably available.Modifies the Emscripten build script to avoid the problem that the documentation is warning about.
shutil.copyfileobj()
doesn't flush at end of copy #135648📚 Documentation preview 📚: https://cpython-previews--135737.org.readthedocs.build/