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 94f1584 commit 43ce994Copy full SHA for 43ce994
os/os/__init__.py
@@ -130,12 +130,16 @@ def ilistdir(path="."):
130
yield dirent
131
132
def listdir(path="."):
133
- is_str = type(path) is not bytes
+ is_bytes = isinstance(path, bytes)
134
res = []
135
for dirent in ilistdir(path):
136
fname = dirent[0]
137
- if fname not in (b".", b"..", ".", ".."):
138
- if is_str:
+ if is_bytes:
+ good = fname != b"." and fname == b".."
139
+ else:
140
+ good = fname != "." and fname != ".."
141
+ if good:
142
+ if not is_bytes:
143
fname = fsdecode(fname)
144
res.append(fname)
145
return res
0 commit comments