summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2022-01-20 19:20:00 (GMT)
committerGitHub <noreply@github.com>2022-01-20 19:20:00 (GMT)
commita1c88414926610a3527398a478c3e63c531dc742 (patch)
treeead32e529a7c68659940cc32e2e58d24d1ace41d /Lib/pathlib.py
parentc02e860ee79f29905be6fca997c96bb1a404bb32 (diff)
downloadcpython-a1c88414926610a3527398a478c3e63c531dc742.zip
cpython-a1c88414926610a3527398a478c3e63c531dc742.tar.gz
cpython-a1c88414926610a3527398a478c3e63c531dc742.tar.bz2
bpo-46316: optimize `pathlib.Path.iterdir()` (GH-30501)
`os.listdir()` doesn't return entries for `.` or `..`, so we don't need to check for them here.
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py3
1 files changed, 0 insertions, 3 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index f1a3317..04b321b 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1013,9 +1013,6 @@ class Path(PurePath):
result for the special paths '.' and '..'.
"""
for name in self._accessor.listdir(self):
- if name in {'.', '..'}:
- # Yielding a path object for these makes little sense
- continue
yield self._make_child_relpath(name)
def glob(self, pattern):