cpython: 197ac5d79456 (original) (raw)

Mercurial > cpython

changeset 90684:197ac5d79456

Issue #19775: Add a samefile() method to pathlib Path objects. Initial patch by Vajrasky Kok. [#19775]

Antoine Pitrou solipsis@pitrou.net
date Tue, 13 May 2014 10:50:15 +0200
parents 560320c10564
children 8885fc2e92b3
files Doc/library/pathlib.rst Lib/pathlib.py Lib/test/test_pathlib.py Misc/NEWS
diffstat 4 files changed, 53 insertions(+), 0 deletions(-)[+] [-] Doc/library/pathlib.rst 19 Lib/pathlib.py 11 Lib/test/test_pathlib.py 20 Misc/NEWS 3

line wrap: on

line diff

--- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -884,6 +884,25 @@ call fails (for example because the path Remove this directory. The directory must be empty. +.. method:: Path.samefile(other_path) +

+

+ .. method:: Path.symlink_to(target, target_is_directory=False) Make this path a symbolic link to target. Under Windows,

--- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -961,6 +961,17 @@ class Path(PurePath): """ return cls(os.getcwd())

+ def iterdir(self): """Iterate over the files in this directory. Does not yield any result for the special paths '.' and '..'.

--- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1251,6 +1251,26 @@ class _BasePathTest(object): p = self.cls.cwd() self._test_cwd(p)

+ def test_empty_path(self): # The empty path points to '.' p = self.cls('')

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -84,6 +84,9 @@ Core and Builtins Library ------- +- Issue #19775: Add a samefile() method to pathlib Path objects. Initial