FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-142407: Doc: Clarify shutil.copyfile() does not use CopyFile2 on Windows by CodeSeeed · Pull Request #144354 · python/cpython · GitHub

/ cpython Public

GH-142407: Doc: Clarify shutil.copyfile() does not use CopyFile2 on Windows - #144354

Closed
CodeSeeed wants to merge 1 commit into
python:mainfrom
CodeSeeed:GH-142407-update-shutil-docs
Closed

GH-142407: Doc: Clarify shutil.copyfile() does not use CopyFile2 on Windows#144354
CodeSeeed wants to merge 1 commit into
python:mainfrom
CodeSeeed:GH-142407-update-shutil-docs

Conversation

CodeSeeed commented Jan 31, 2026
edited by github-actions Bot
Loading

Copy link
Copy Markdown

The current documentation for shutil implies that all copy functions benefit from fast kernel-space copying on Windows via the CopyFile2 API. However, shutil.copyfile() is an exception — it still uses a userspace read/write loop.

This PR clarifies that:

  • shutil.copy(), copy2(), copytree(), and move() use CopyFile2 (when available)
  • shutil.copyfile() does not, and remains a buffered userspace copy
  • Provides practical guidance: prefer copy2() over copyfile() for better performance on Windows when metadata preservation is acceptable

The change has been verified by:

  • Building the docs locally with make html (0 warnings)
  • Confirming the rendered HTML displays the updated text correctly

Related to GH-142407.


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

CodeSeeed requested a review from giampaolo as a code owner January 31, 2026 03:03

python-cla-bot Bot commented Jan 31, 2026
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Jan 31, 2026
github-project-automation Bot moved this to Todo in Docs PRs Jan 31, 2026
CodeSeeed changed the title Doc: Clarify that shutil.copyfile() does not use CopyFile2 on Windows GH-142407: Doc: Clarify shutil.copyfile() does not use CopyFile2 on Windows Jan 31, 2026

picnixz commented Feb 1, 2026

Copy link
Copy Markdown
Member

There is already #142408. Please do not open PRs if there are already ones that exist for the issue.

picnixz closed this Feb 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL