-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
shutil.chown should support dir_fd and follow_symlinks keyword arguments #62308
Comments
Python 3.3 added the dir_fd and follow_symlinks keyword arguments to os.chown; it also added the shutil.chown function. Unfortunately the latter, while useful, does not support these new keyword arguments. It would be helpful if it did. |
Hi. Would you like to provide a patch? |
Here's a patch. |
Looks good to me. But aren't the last two lines skipped if an error is raised by the first line from the with block? + with self.assertRaises(FileNotFoundError): |
I got a failure on FreeBSD: [1/1] test_shutil
test test_shutil failed -- Traceback (most recent call last):
File "/tank/libs/cpython/Lib/test/test_shutil.py", line 1258, in test_chown
shutil.chown(os.path.basename(filename), dir_fd=dirfd)
File "/tank/libs/cpython/Lib/shutil.py", line 983, in chown
raise ValueError("user and/or group must be set")
ValueError: user and/or group must be set It seems that either user or group argument must be passed along with dir_fd. |
I was looking for an easy patch to submit. I can take an attempt at this? |
Hi everybody, I just submitted a PR for this issue. It's my first contribution to the cPython project so please let me know if I need to change anything. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
dir_fd
&follow_symlinks
toshutil.chown
#118136The text was updated successfully, but these errors were encountered: