summaryrefslogtreecommitdiffstats
path: root/Lib/glob.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-05 20:17:10 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-05 20:17:10 (GMT)
commit3ae41554c69b807659fab815ad5675bed5ae237e (patch)
tree9c1db5f7b30801810282bafe0fece78bd58ccdc6 /Lib/glob.py
parentfae2829c7a3bd3ac1b2e57c1bc3894ce459af0e1 (diff)
downloadcpython-3ae41554c69b807659fab815ad5675bed5ae237e.zip
cpython-3ae41554c69b807659fab815ad5675bed5ae237e.tar.gz
cpython-3ae41554c69b807659fab815ad5675bed5ae237e.tar.bz2
Issue #27998: Removed workarounds for supporting bytes paths on Windows in
os.walk() function and glob module since os.scandir() now directly supports them.
Diffstat (limited to 'Lib/glob.py')
-rw-r--r--Lib/glob.py23
1 files changed, 7 insertions, 16 deletions
diff --git a/Lib/glob.py b/Lib/glob.py
index 7c3cccb..002cd92 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -118,22 +118,13 @@ def _iterdir(dirname, dironly):
else:
dirname = os.curdir
try:
- if os.name == 'nt' and isinstance(dirname, bytes):
- names = os.listdir(dirname)
- if dironly:
- for name in names:
- if os.path.isdir(os.path.join(dirname, name)):
- yield name
- else:
- yield from names
- else:
- with os.scandir(dirname) as it:
- for entry in it:
- try:
- if not dironly or entry.is_dir():
- yield entry.name
- except OSError:
- pass
+ with os.scandir(dirname) as it:
+ for entry in it:
+ try:
+ if not dironly or entry.is_dir():
+ yield entry.name
+ except OSError:
+ pass
except OSError:
return