From f815a2a9f0d785660cebb60facc2e8941fba2d43 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 24 Dec 2015 00:35:57 +0200 Subject: [PATCH] os: Proactively filter all str/bytes variants of "."/"..". --- os/os/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/os/os/__init__.py b/os/os/__init__.py index 2a72bbf6..dec92677 100644 --- a/os/os/__init__.py +++ b/os/os/__init__.py @@ -132,7 +132,7 @@ def listdir(path="."): res = [] for dirent in ilistdir(path): fname = dirent[0] - if fname != b"." and fname != b"..": + if fname not in (b".", b"..", ".", ".."): if is_str: fname = fsdecode(fname) res.append(fname)