[issue27180] Doc/pathlib: Please describe the behaviour of Path().rename() is depends on the platform (same as os.rename())

New submission from Masato HASHIMOTO: 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. ---------- assignee: docs@python components: Documentation messages: 266883 nosy: docs@python, hashimo priority: normal severity: normal status: open title: Doc/pathlib: Please describe the behaviour of Path().rename() is depends on the platform (same as os.rename()) type: enhancement versions: Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________

Changes by Berker Peksag <berker.peksag@gmail.com>: ---------- keywords: +easy stage: -> needs patch versions: -Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________

Evelyn Mitchell added the comment: *** 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') ---------- nosy: +Evelyn Mitchell _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________

Berker Peksag added the comment: Could you please send your patch in unified diff format? See https://docs.python.org/devguide/patch.html for details. ---------- nosy: +berker.peksag stage: needs patch -> patch review _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________

Changes by Evelyn Mitchell <efmphone@gmail.com>: Added file: http://bugs.python.org/file43289/patch27180 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________

STINNER Victor added the comment: patch27180. LGTM. ---------- nosy: +haypo _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________

Roundup Robot added the comment: 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 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________

Berker Peksag added the comment: Thanks! ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27180> _______________________________________
participants (5)
-
Berker Peksag
-
Evelyn Mitchell
-
Masato HASHIMOTO
-
Roundup Robot
-
STINNER Victor