classification
Title: Doc/pathlib: Please describe the behaviour of Path().rename() is depends on the platform (same as os.rename())
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Evelyn Mitchell, berker.peksag, docs@python, hashimo, python-dev, vstinner
Priority: normal Keywords: easy

Created on 2016-06-02 11:18 by hashimo, last changed 2016-07-14 04:45 by berker.peksag. This issue is now closed.

Files
File name Uploaded Description Edit
patch27180 Evelyn Mitchell, 2016-06-08 01:19 review
Messages (6)
msg266883 - (view) Author: Masato HASHIMOTO (hashimo) Date: 2016-06-02 11:18
The behavior of Path().rename() is same as os.rename() (replaces silently if dest file is already existent on Unix) but it's difficult to catch from current pathlib documentation (I found it from source of pathlib) from comparing with replace().

IMHO, it should be described on pathlilb documentation.
msg267708 - (view) Author: Evelyn Mitchell (Evelyn Mitchell) * (Python triager) Date: 2016-06-07 17:45
*** cpythonmod/Doc/library/pathlib.rst  2016-06-07 11:29:07.200774979 -0600
--- cpython/Doc/library/pathlib.rst     2016-06-07 11:29:59.372777817 -0600
***************
*** 887,896 ****
  
  .. method:: Path.rename(target)
  
!    Rename this file or directory to the given *target*. On Unix, 
!    if *target* exists and is a file, it will be replaced silently 
!    if the user has permission. *target* can be either a string or 
!    another path object::
  
        >>> p = Path('foo')
        >>> p.open('w').write('some text')
--- 887,894 ----
  
  .. method:: Path.rename(target)
  
!    Rename this file or directory to the given *target*.  *target* can be
!    either a string or another path object::
  
        >>> p = Path('foo')
        >>> p.open('w').write('some text')
msg267759 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-08 01:05
Could you please send your patch in unified diff format? See https://docs.python.org/devguide/patch.html for details.
msg270271 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-07-12 22:11
patch27180. LGTM.
msg270367 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-07-14 04:45
New changeset 270fd4493195 by Berker Peksag in branch '3.5':
Issue #27180: Clarify Path.rename() behavior on Unix systems
https://hg.python.org/cpython/rev/270fd4493195

New changeset 89821243621b by Berker Peksag in branch 'default':
Issue #27180: Merge from 3.5
https://hg.python.org/cpython/rev/89821243621b
msg270368 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-07-14 04:45
Thanks!
History
Date User Action Args
2016-07-14 04:45:56berker.peksagsetstatus: open -> closed
resolution: fixed
messages: + msg270368

stage: patch review -> resolved
2016-07-14 04:45:03python-devsetnosy: + python-dev
messages: + msg270367
2016-07-12 22:11:59vstinnersetnosy: + vstinner
messages: + msg270271
2016-06-08 01:19:30Evelyn Mitchellsetfiles: + patch27180
2016-06-08 01:05:57berker.peksagsetnosy: + berker.peksag

messages: + msg267759
stage: needs patch -> patch review
2016-06-07 17:45:50Evelyn Mitchellsetnosy: + Evelyn Mitchell
messages: + msg267708
2016-06-02 15:38:44berker.peksagsetkeywords: + easy
stage: needs patch
versions: - Python 3.4
2016-06-02 11:18:19hashimocreate