classification
Title: Update os.samefile docstring to match documentation
Type: behavior Stage: backport needed
Components: Documentation Versions: Python 3.8, Python 3.7, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eMPee584, miss-islington, r.david.murray, steve.dower
Priority: normal Keywords: patch

Created on 2017-07-20 08:07 by eMPee584, last changed 2019-08-02 23:11 by miss-islington.

Pull Requests
URL Status Linked Edit
PR 7337 merged tuxtimo, 2018-06-02 11:58
PR 15086 merged miss-islington, 2019-08-02 22:44
PR 15087 merged miss-islington, 2019-08-02 22:44
Messages (9)
msg298708 - (view) Author: Marcel Partap (eMPee584) Date: 2017-07-20 08:07
Don't know whether it should be considered a documentation or behavioral issue, but os.samefile calls os.stat() on given files, following symlinks. Does this really "test whether two pathnames reference the same actual file"? I'd consider os.lstat() more suited for that.

This bites me every time I want to overwrite a symlink with its referenced file using ranger.
msg298731 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-20 15:47
I would take "actual file" as meaning the file the symlink points to, so I'd say the documentation matches the implementation according to your description of the two.  The current docs actually say "refer to the same file or directory", and mention os.stat explicitly, so again I'd say the docs and implementation match.

It sounds like what you want is to open a feature request for a samefile equivalent that does not follow symlinks.  lsamefile?

We could use this issue for making the docstring match the docs, though.  I think the sentence in the docs is short enough to just get copied into the docstring.
msg322555 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-07-28 12:56
I think the docs are too specific about the mechanism used here - if we document *how* it works then we may not be able to make it work correctly (with a different mechanic) on a different platform.
msg322556 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2018-07-28 12:56
Sorry, I meant the docs after the patch. Before, it's fine.
msg348928 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-08-02 22:44
New changeset 8e568ef266a2805f9a6042003723d9c050830461 by Steve Dower (Timo Furrer) in branch 'master':
bpo-30974: Change os.path.samefile docstring to match docs (GH-7337)
https://github.com/python/cpython/commit/8e568ef266a2805f9a6042003723d9c050830461
msg348929 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-08-02 22:46
I'm not personally thrilled about it being documented like this, but it's certainly how the current documentation reads. Consistency is better until we get motivated enough to fix all of it.

Thanks for the patch!
msg348930 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-08-02 22:46
Still needs a 2.7 backport if someone would like to do it.
msg348932 - (view) Author: miss-islington (miss-islington) Date: 2019-08-02 23:04
New changeset 6b833901fe9053937c289c6371bb731c9aceb58e by Miss Islington (bot) in branch '3.8':
bpo-30974: Change os.path.samefile docstring to match docs (GH-7337)
https://github.com/python/cpython/commit/6b833901fe9053937c289c6371bb731c9aceb58e
msg348933 - (view) Author: miss-islington (miss-islington) Date: 2019-08-02 23:11
New changeset a49f203e052c6fb1244d4e55c3fccc439dda0e2e by Miss Islington (bot) in branch '3.7':
bpo-30974: Change os.path.samefile docstring to match docs (GH-7337)
https://github.com/python/cpython/commit/a49f203e052c6fb1244d4e55c3fccc439dda0e2e
History
Date User Action Args
2019-08-02 23:11:36miss-islingtonsetmessages: + msg348933
2019-08-02 23:04:57miss-islingtonsetnosy: + miss-islington
messages: + msg348932
2019-08-02 22:46:38steve.dowersetmessages: + msg348930
2019-08-02 22:46:09steve.dowersetmessages: + msg348929
stage: patch review -> backport needed
2019-08-02 22:44:57miss-islingtonsetpull_requests: + pull_request14832
2019-08-02 22:44:51miss-islingtonsetpull_requests: + pull_request14831
2019-08-02 22:44:27steve.dowersetmessages: + msg348928
2018-07-28 12:56:59steve.dowersetkeywords: - easy
2018-07-28 12:56:47steve.dowersetmessages: + msg322556
2018-07-28 12:56:35steve.dowersetnosy: + steve.dower
messages: + msg322555
2018-06-02 11:58:23tuxtimosetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request6968
2018-03-04 22:06:32cheryl.sabellasetkeywords: + easy
stage: needs patch
versions: + Python 3.8, - Python 3.6
2017-07-20 15:47:15r.david.murraysetassignee: docs@python

components: + Documentation
title: os.samefile / shutil._samefile: following symlinks -> Update os.samefile docstring to match documentation
nosy: + docs@python, r.david.murray
versions: + Python 3.6, Python 3.7
messages: + msg298731
2017-07-20 08:07:10eMPee584create