MCPcopy Index your code
hub / github.com/python/cpython / _fastcopy_fcopyfile

Function _fastcopy_fcopyfile

Lib/shutil.py:98–116  ·  view source on GitHub ↗

Copy a regular file content or metadata by using high-performance fcopyfile(3) syscall (macOS).

(fsrc, fdst, flags)

Source from the content-addressed store, hash-verified

96 """
97
98def _fastcopy_fcopyfile(fsrc, fdst, flags):
99 """Copy a regular file content or metadata by using high-performance
100 fcopyfile(3) syscall (macOS).
101 """
102 try:
103 infd = fsrc.fileno()
104 outfd = fdst.fileno()
105 except Exception as err:
106 raise _GiveupOnFastCopy(err) # not a regular file
107
108 try:
109 posix._fcopyfile(infd, outfd, flags)
110 except OSError as err:
111 err.filename = fsrc.name
112 err.filename2 = fdst.name
113 if err.errno in {errno.EINVAL, errno.ENOTSUP}:
114 raise _GiveupOnFastCopy(err)
115 else:
116 raise err from None
117
118def _determine_linux_fastcopy_blocksize(infd):
119 """Determine blocksize for fastcopying on Linux.

Callers 1

copyfileFunction · 0.85

Calls 2

_GiveupOnFastCopyClass · 0.85
filenoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…