cpython: 5310f94772f4 (original) (raw)

Mercurial > cpython

changeset 100185:5310f94772f4 3.5

Issue #25911: Restored support of bytes paths in os.walk() on Windows. [#25911]

Serhiy Storchaka storchaka@gmail.com
date Mon, 08 Feb 2016 16:23:28 +0200
parents 966bd147ccb5
children b060af2a58b6 8ec721bb3027
files Lib/os.py Lib/test/test_os.py Misc/NEWS
diffstat 3 files changed, 41 insertions(+), 10 deletions(-)[+] [-] Lib/os.py 27 Lib/test/test_os.py 22 Misc/NEWS 2

line wrap: on

line diff

--- a/Lib/os.py +++ b/Lib/os.py @@ -363,9 +363,12 @@ def walk(top, topdown=True, onerror=None # minor reason when (say) a thousand readable directories are still # left to visit. That logic is copied here. try:

@@ -418,8 +421,8 @@ def walk(top, topdown=True, onerror=None # Recurse into sub-directories islink, join = path.islink, path.join

@@ -430,6 +433,20 @@ def walk(top, topdown=True, onerror=None # Yield after recursion if going bottom up yield top, dirs, nondirs +class _DummyDirEntry:

+ +def _dummy_scandir(dir):

+ all.append("walk") if {open, stat} <= supports_dir_fd and {listdir, stat} <= supports_fd:

--- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -791,10 +791,10 @@ class WalkTests(unittest.TestCase): # Wrapper to hide minor differences between os.walk and os.fwalk # to tests both functions with the same code base

def setUp(self): join = os.path.join @@ -945,11 +945,10 @@ class WalkTests(unittest.TestCase): class FwalkTests(WalkTests): """Tests for os.fwalk()."""

- def _compare_to_walk(self, walk_kwargs, fwalk_kwargs): """ compare with walk() results. @@ -1020,6 +1019,19 @@ class FwalkTests(WalkTests): os.unlink(name, dir_fd=rootfd) os.rmdir(support.TESTFN) +class BytesWalkTests(WalkTests):

+ class MakedirTests(unittest.TestCase): def setUp(self):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -73,6 +73,8 @@ Core and Builtins Library ------- +- Issue #25911: Restored support of bytes paths in os.walk() on Windows. +