classification
Title: Update os.samefile docstring to match documentation
Type: behavior Stage: patch review
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, r.david.murray
Priority: normal Keywords: easy, patch

Created on 2017-07-20 08:07 by eMPee584, last changed 2018-06-02 11:58 by tuxtimo.

Pull Requests
URL Status Linked Edit
PR 7337 open tuxtimo, 2018-06-02 11:58
Messages (2)
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.
History
Date User Action Args
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