Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1de1a6a commit c98b26aCopy full SHA for c98b26a
1 file changed
Lib/glob.py
@@ -118,13 +118,22 @@ def _iterdir(dirname, dironly):
118
else:
119
dirname = os.curdir
120
try:
121
- with os.scandir(dirname) as it:
122
- for entry in it:
123
- try:
124
- if not dironly or entry.is_dir():
125
- yield entry.name
126
- except OSError:
127
- pass
+ 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:
128
+ yield from names
129
130
+ with os.scandir(dirname) as it:
131
+ for entry in it:
132
+ try:
133
+ if not dironly or entry.is_dir():
134
+ yield entry.name
135
+ except OSError:
136
+ pass
137
except OSError:
138
return
139
0 commit comments