Bug report
Bug description:
I think it's a regression from #142693.
copyfile() rejects a symlink to a device even when follow_symlinks=False.
import os
import shutil
import tempfile
with tempfile.TemporaryDirectory() as directory:
src = os.path.join(directory, "src")
dst = os.path.join(directory, "dst")
os.symlink("/dev/null", src)
shutil.copyfile(src, dst, follow_symlinks=False)
- Current behavior:
shutil.SpecialFileError: .../src is a character device
- Expected:
dst is created as a symlink to /dev/null
The docs say:
If follow_symlinks is false and src is a symbolic link, a new symbolic link will be created instead of copying the file src points to.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Bug report
Bug description:
I think it's a regression from #142693.
copyfile()rejects a symlink to a device even whenfollow_symlinks=False.shutil.SpecialFileError:.../srcis a character devicedstis created as a symlink to/dev/nullThe docs say:
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
shutil.copyfile()for device symlinks withfollow_symlinks=False#154728