Skip to content

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

Merged
merged 3 commits into from
Jun 24, 2025

Conversation

freakboy3742
Copy link
Contributor

@freakboy3742 freakboy3742 commented Jun 20, 2025

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.


📚 Documentation preview 📚: https://cpython-previews--135737.org.readthedocs.build/

Comment on lines 1 to 2
The documentation for :func:`shutil.copyfileobj` now warns the user of the
need to close or flush the destination stream on completion.
Copy link
Member

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?

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@hoodmane
Copy link
Contributor

Thanks @freakboy3742!

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@freakboy3742 freakboy3742 merged commit 34393cb into python:main Jun 24, 2025
46 checks passed
@freakboy3742 freakboy3742 deleted the copyfileobj-flush branch June 24, 2025 00:55
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Jun 24, 2025
@miss-islington-app
Copy link

Thanks @freakboy3742 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2025
…thonGH-135737)

Adds a note about flush/close on copyfileobj, and updates
the Emscripten build script to follow documented advice.
(cherry picked from commit 34393cbdd46fd965de86f1e7bc89ab111f506723)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
@bedevere-app
Copy link

bedevere-app bot commented Jun 24, 2025

GH-135873 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Jun 24, 2025
freakboy3742 added a commit that referenced this pull request Jun 24, 2025
…H-135737) (#135873)

Adds a note about flush/close on copyfileobj, and updates
the Emscripten build script to follow documented advice.
(cherry picked from commit 34393cb)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants