Skip to content

[2.7] bpo-34260, shutil: fix copy2 and copystat documentation (GH-8523) #10071

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 1 commit into from
Oct 24, 2018

Conversation

csernazs
Copy link
Contributor

@csernazs csernazs commented Oct 23, 2018

Fix the documentation of copy2, as it does not copy file ownership (user and
group), only mode, mtime, atime and flags.

The original text was confusing to developers as it suggested that this
command is the same as 'cp -p', but according to cp(1), '-p' copies file
ownership as well.

Clarify which metadata is copied by shutil.copystat in its docstring..
(cherry picked from commit 4f399be)

Co-authored-by: Zsolt Cserna [email protected]

https://bugs.python.org/issue34260

Lib/shutil.py Outdated
flags from `src` to `dst`. On Linux, copystat() also copies the "extended
attributes" where possible. The file contents, owner, and group are
unaffected. `src` and `dst` are path names given as strings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: please remove the empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why there was a newline is that almos 99% of the functions are documented like this, by having an extra line at the end of the docstring. What I did is just following this "rule" here.
But anyway, I removed it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The reason why there was a newline is that almos 99% of the functions are documented like this, by having an extra line at the end of the docstring."

Well... Python has a long history. Python has been created before PEP 7, PEP 8, PEP 257, etc. I don't see an advice to insert an empty line at the end of docstring in the docstring convention PEP: https://www.python.org/dev/peps/pep-0257/

cc @ambv: any progress on your secret project to convert Python to Black? ;-)

…GH-8523)

Fix the documentation of copy2, as it does not copy file ownership (user and
group), only mode, mtime, atime and flags.

The original text was confusing to developers as it suggested that this
command is the same as 'cp -p', but according to cp(1), '-p' copies file
ownership as well.

Clarify which metadata is copied by shutil.copystat in its docstring..
(cherry picked from commit 4f399be)

Co-authored-by: Zsolt Cserna <[email protected]>
@csernazs csernazs force-pushed the backport-4f399be-2.7 branch from 11f2c1c to a940ee3 Compare October 24, 2018 06:21
@vstinner vstinner merged commit 4a59c96 into python:2.7 Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants