Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

shutil.copyfile should use ReFS block-level linking on Windows (by invoking CopyFileW) #137074

Closed
Labels
OS-windowsstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
@Dico200

Description

@Dico200

Bug report

Bug description:

shutil.copyfile("./scratch.txt","./target.txt")

copyfile for copies within a single ReFS volume (or Dev Drive) on Windows 11 does not take advantage of block-level linking capability present in ReFS file system. On the other hand, the kernel automatically does so when you invoke CopyFileW these days. C#/.NET use kernel functions for file copy APIs and automatically take advantage of this too.

Python does not offer an API that takes advantage of block-level linking except for directly invoking CopyFileW using windlls.kernel32 from ctypes.

https://docs.python.org/3/library/shutil.html#shutil-platform-dependent-efficient-copy-operations
CopyFileW should be used instead of streaming data from one file to another, at least in circumstances where block-level linking is possible.

Relevant code:

withopen(src,'rb')asfsrc:

CPython versions tested on:

3.9

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp