8000 GH-73991: Support preserving metadata in `pathlib.Path.copy()` by barneygale · Pull Request #120806 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-73991: Support preserving metadata in pathlib.Path.copy() #120806

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 15 commits into from
Jul 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tighten conditions.
  • Loading branch information
barneygale committed Jun 21, 2024
commit b05256b9fab329d865221b471df97c6952fa7834
4 changes: 2 additions & 2 deletions Lib/pathlib/_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def lookup(name):
# We must copy extended attributes before the file is (potentially)
# chmod()'ed read-only, otherwise setxattr() will error with -EACCES.
xattrs = metadata.get('xattrs')
if xattrs:
if xattrs is not None:
for attr, value in xattrs:
try:
os.setxattr(path, attr, value, follow_symlinks=follow_symlinks)
Expand All @@ -226,7 +226,7 @@ def lookup(name):
# (which is what shutil always did in this circumstance.)
pass
flags = metadata.get('flags')
if flags:
if flags is not None:
try:
lookup("chflags")(path, flags, follow_symlinks=follow_symlinks)
except OSError as why:
Expand Down
Loading
0